Setup¶

Install in R:

install.packages("BiocManager")
BiocManager::install(c("edgeR", "BiocParallel", "RhpcBLASctl"))

Install

pip install toytree ete4 pybiomart

Options & Data¶

In [ ]:
%load_ext autoreload
%autoreload 2

import os
import re
import pickle
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.sparse import issparse
from pymer4.models import lmer, lm, glmer, compare
from pymer4 import config
import polars
import statsmodels.api as sm
import senepy
import gseapy as gp
import pertpy as pt
import scanpy as sc
import pandas as pd
import numpy as np
import scflow
from scflow.ax import find_senescence_genes, run_senepy


os.environ["KMP_DUPLICATE_LIB_OK"] = "True"
config.PANDAS_BACKEND = True

pd.set_option("display.max_rows", 500)  # or None for unlimited rows
pd.set_option("display.max_columns", 100)
pd.set_option("display.max_colwidth", 100)
pd.set_option("display.width", 300)

ncpus = os.cpu_count() - 1
overwrite = True

# If You Want Results Emailed (Will Overwrite HTML Regardless of `overwite`)
cur_file = os.path.join(os.path.abspath(""), "analyze_senescence_celltype"
                        "_specific_threshold.ipynb")
html_out = os.path.splitext(cur_file)[0] + ".html"
email = "elizabeth.aslinger@aya.yale.edu"
# set email to None to skip

# Cell Type Label Column
col_celltype = "annotation_by_overlap"
# col_celltype = "Annotation_ToppGene"
# col_celltype = "cellmap_class_name"
# col_celltype = "cellmap_class_name_collapsed"
# use_hierarchy = False
use_hierarchy = True  # collapse neuron categories?

# Metadata Information
species = "Mouse"
col_sample, col_batch = "sample", "Group"
# col_age = "Characteristics[Age at Euthanasia]"
# col_condition = "Factor Value[Spaceflight]"
col_age = "Age_End"
col_condition = "Condition"
group_order = ["Ground Control | 12 Weeks", "Ground Control | 29 Weeks",
               "Space Flight | 12 Weeks", "Space Flight | 29 Weeks"]
# group_order = ["Ground Control | 20 Weeks", "Ground Control | 37 Weeks",
#                "Space Flight | 20 Weeks", "Space Flight | 37 Weeks"]
keys = {col_condition: dict(key_control="Ground Control",
                            key_treatment="Space Flight"),
        # col_age: dict(key_control="20 Weeks",
        #               key_treatment="37 Weeks"),
        col_age: dict(key_control="12 Weeks",
                      key_treatment="29 Weeks"),
        col_batch: dict(key_control=group_order[0],
                        key_treatment=group_order[1:])}
palette = {col_condition: {keys[col_condition]["key_control"]: "b",
                           keys[col_condition]["key_treatment"]: "r"},
           col_age: {keys[col_age]["key_control"]: "g",
                     keys[col_age]["key_treatment"]: "y"},
           col_batch: dict(zip(group_order, ["c", "b", "tab:pink", "r"]))}

# Scoring Metrics
sen_metrics = ["senmayo"]
# sen_metrics = ["senepy", "senmayo"]
use_metric = "senmayo"
percentile = 1

# File Input & Output
file_path = "data/OSD-613_integrated.h5ad"
file_path_new = os.path.splitext(file_path)[0] + "_analyzed.h5ad"

# Load Data
self = scflow.Rna(file_path, col_sample=col_sample, col_batch=col_batch,
                  col_celltype=col_celltype)  # data
self.rna.obs.loc[:, col_batch] = self.rna.obs[col_batch].astype(
    pd.CategoricalDtype(categories=group_order, ordered=True))
self.rna.obs.loc[:, "Spaceflight"] = (self.rna.obs[col_condition] == keys[
    col_condition]["key_treatment"]).astype(int)  # 1 vs. 0 spaceflight
self.rna.obs.loc[:, "Aged"] = (self.rna.obs[col_age] == keys[
    col_age]["key_treatment"]).astype(int)  # 1 vs. 0 older
self.rna = self.rna[:, self.rna.var.mt == False]  # snRNA-seq so remove MT-
self.rna = self.rna[:, self.rna.var.ribo == False]  # snRNA-seq so remove RB-

# Hierarchical
keys_cts = {"Neuron": ["Excitatory", "Inhibitory", "Excitatory-Inhibitory"],
            "Macroglia": ["Oligodendrocyte", "OPC", "Astrocyte"],
            "Microglia": ["Microglial"]}
key_cts = dict(pd.concat([pd.Series(dict(([(i, x) for i in keys_cts[
    x]]))) for x in keys_cts]))
self.rna.obs.loc[:, f"{col_celltype}_hierarchy"] = self.rna.obs[
    col_celltype].replace(key_cts)
if use_hierarchy is True:
    col_celltype = f"{col_celltype}_hierarchy"
    self.col_celltype = col_celltype
self.rna.raw = None

# Display Object
print(self.rna)
print(self.rna.obs.groupby(col_sample).describe())
self.rna.obs
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/senepy/load_hubs.py:3: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
  from pkg_resources import resource_filename
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/marshmallow/__init__.py:17: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  __version_info__ = tuple(LooseVersion(__version__).version)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/marshmallow/fields.py:198: RemovedInMarshmallow4Warning: Passing field metadata as a keyword arg is deprecated. Use the explicit `metadata=...` argument instead.
  warnings.warn(
AnnData object with n_obs × n_vars = 103274 × 12097
    obs: 'Group', 'sample', 'Characteristics[Organism]', 'Term Source REF', 'Term Accession Number', 'Characteristics[Strain]', 'Term Source REF.1', 'Term Accession Number.1', 'Characteristics[Genotype]', 'Term Source REF.2', 'Term Accession Number.2', 'Characteristics[Animal Source]', 'Characteristics[Sex]', 'Term Source REF.3', 'Term Accession Number.3', 'Factor Value[Spaceflight]', 'Term Source REF.4', 'Term Accession Number.4', 'Factor Value[Age]', 'Unit', 'Term Source REF.5', 'Term Accession Number.5', 'Characteristics[Material Type]', 'Term Source REF.6', 'Term Accession Number.6', 'Characteristics[diet]', 'Characteristics[Feeding Schedule]', 'Characteristics[Age at Euthanasia]', 'Unit.1', 'Term Source REF.7', 'Term Accession Number.7', 'Protocol REF', 'Parameter Value[habitat]', 'Parameter Value[Enrichment material]', 'Parameter Value[duration]', 'Unit.2', 'Term Source REF.8', 'Term Accession Number.8', 'Parameter Value[light cycle]', 'Protocol REF.1', 'Parameter Value[Euthanasia Method]', 'Parameter Value[Sample Preservation Method]', 'Term Source REF.9', 'Term Accession Number.9', 'Parameter Value[Sample Storage Temperature]', 'Unit.3', 'Term Source REF.10', 'Term Accession Number.10', 'Comment[RFID]', 'Comment[Euthanasia Date]', 'n_cells_original_sample', 'min_max_genes', 'min_max_cells', 'max_mt', 'min_max_counts', 'zero_center', 'max_value', 'doublet_detection', 'n_genes_by_counts', 'total_counts', 'log1p_n_genes_by_counts', 'log1p_total_counts', 'total_counts_mt', 'pct_counts_mt', 'log1p_total_counts_mt', 'total_counts_ribo', 'pct_counts_ribo', 'log1p_total_counts_ribo', 'total_counts_hb', 'pct_counts_hb', 'log1p_total_counts_hb', 'n_counts', 'n_genes', 'doublet_score', 'predicted_doublet', 'resolution_individual', 'min_dist_individual', 'leiden_individual', 'annotation_by_markers_individual', 'annotation_by_markers_individual_heterogeneous_collapsed', '_scvi_batch', '_scvi_labels', 'annotation_scanvi', 'kws_integrate', 'leiden', 'leiden_resolution', 'leiden_n_neighbors', 'leiden_min_dist', 'annotation_by_overlap', 'annotation_toppgene', 'predicted_labels', 'majority_voting', 'majority_voting_probabilities', 'majority_voting_short', 'annotation_majority_voting', 'Age_Start', 'Age_End', 'Condition', 'Spaceflight', 'Aged', 'annotation_by_overlap_hierarchy'
    var: 'mt', 'ribo', 'hb', 'n_cells_by_counts', 'total_counts', 'mean_counts', 'pct_dropout_by_counts', 'log1p_total_counts', 'log1p_mean_counts'
    uns: 'Group_colors', '_scvi_manager_uuid', '_scvi_uuid', 'annotation_by_overlap_colors', 'annotation_majority_voting_colors', 'annotation_toppgene_colors', 'leiden', 'leiden_colors', 'neighbors', 'over_clustering', 'rank_genes_groups_leiden', 'sample_colors', 'umap'
    obsm: 'X_pca', 'X_pca_old', 'X_scANVI', 'X_scVI', 'X_umap', '_scvi_extra_categorical_covs'
    layers: 'counts', 'log1p', 'scaled'
    obsp: 'connectivities', 'distances'
                             Factor Value[Age]                                          Characteristics[Age at Euthanasia]                                          Parameter Value[duration]                                          Parameter Value[Sample Storage Temperature]                         \
                                         count  mean  std   min   25%   50%   75%   max                              count  mean  std   min   25%   50%   75%   max                     count  mean  std   min   25%   50%   75%   max                                       count  mean  std   min   25%   
sample                                                                                                                                                                                                                                                                                                      
RRRM2_BRN_GC_ISS-T_YNG_GY4              7547.0  12.0  0.0  12.0  12.0  12.0  12.0  12.0                             7547.0  20.0  0.0  20.0  20.0  20.0  20.0  20.0                    7547.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                      7547.0 -80.0  0.0 -80.0 -80.0   
RRRM2_BRN_GC_ISS-T_YNG_GY9              5465.0  12.0  0.0  12.0  12.0  12.0  12.0  12.0                             5465.0  20.0  0.0  20.0  20.0  20.0  20.0  20.0                    5465.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                      5465.0 -80.0  0.0 -80.0 -80.0   
RRRM2_BRN_GC_ISS-T_OLD_GO18             5842.0  29.0  0.0  29.0  29.0  29.0  29.0  29.0                             5842.0  37.0  0.0  37.0  37.0  37.0  37.0  37.0                    5842.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                      5842.0 -80.0  0.0 -80.0 -80.0   
RRRM2_BRN_FLT_ISS-T_OLD_FO20            4922.0  29.0  0.0  29.0  29.0  29.0  29.0  29.0                             4922.0  37.0  0.0  37.0  37.0  37.0  37.0  37.0                    4922.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                      4922.0 -80.0  0.0 -80.0 -80.0   
RRRM2_BRN_GC_ISS-T_OLD_GO19             7539.0  29.0  0.0  29.0  29.0  29.0  29.0  29.0                             7539.0  37.0  0.0  37.0  37.0  37.0  37.0  37.0                    7539.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                      7539.0 -80.0  0.0 -80.0 -80.0   
RRRM2_BRN_GC_ISS-T_OLD_GO13             3595.0  29.0  0.0  29.0  29.0  29.0  29.0  29.0                             3595.0  37.0  0.0  37.0  37.0  37.0  37.0  37.0                    3595.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                      3595.0 -80.0  0.0 -80.0 -80.0   
RRRM2_BRN_FLT_ISS-T_YNG_FY8             5095.0  12.0  0.0  12.0  12.0  12.0  12.0  12.0                             5095.0  20.0  0.0  20.0  20.0  20.0  20.0  20.0                    5095.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                      5095.0 -80.0  0.0 -80.0 -80.0   
RRRM2_BRN_FLT_ISS-T_YNG_FY7             3669.0  12.0  0.0  12.0  12.0  12.0  12.0  12.0                             3669.0  20.0  0.0  20.0  20.0  20.0  20.0  20.0                    3669.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                      3669.0 -80.0  0.0 -80.0 -80.0   
RRRM2_BRN_FLT_ISS-T_OLD_FO19            5747.0  29.0  0.0  29.0  29.0  29.0  29.0  29.0                             5747.0  37.0  0.0  37.0  37.0  37.0  37.0  37.0                    5747.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                      5747.0 -80.0  0.0 -80.0 -80.0   
RRRM2_BRN_GC_ISS-T_YNG_GY7              5265.0  12.0  0.0  12.0  12.0  12.0  12.0  12.0                             5265.0  20.0  0.0  20.0  20.0  20.0  20.0  20.0                    5265.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                      5265.0 -80.0  0.0 -80.0 -80.0   
RRRM2_BRN_FLT_ISS-T_OLD_FO14            3864.0  29.0  0.0  29.0  29.0  29.0  29.0  29.0                             3864.0  37.0  0.0  37.0  37.0  37.0  37.0  37.0                    3864.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                      3864.0 -80.0  0.0 -80.0 -80.0   
RRRM2_BRN_GC_ISS-T_YNG_GY1              3672.0  12.0  0.0  12.0  12.0  12.0  12.0  12.0                             3672.0  20.0  0.0  20.0  20.0  20.0  20.0  20.0                    3672.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                      3672.0 -80.0  0.0 -80.0 -80.0   
RRRM2_BRN_FLT_ISS-T_YNG_FY2             3730.0  12.0  0.0  12.0  12.0  12.0  12.0  12.0                             3730.0  20.0  0.0  20.0  20.0  20.0  20.0  20.0                    3730.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                      3730.0 -80.0  0.0 -80.0 -80.0   
RRRM2_BRN_FLT_ISS-T_OLD_FO17            1321.0  29.0  0.0  29.0  29.0  29.0  29.0  29.0                             1321.0  37.0  0.0  37.0  37.0  37.0  37.0  37.0                    1321.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                      1321.0 -80.0  0.0 -80.0 -80.0   
RRRM2_BRN_GC_ISS-T_OLD_GO16            18386.0  29.0  0.0  29.0  29.0  29.0  29.0  29.0                            18386.0  37.0  0.0  37.0  37.0  37.0  37.0  37.0                   18386.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                     18386.0 -80.0  0.0 -80.0 -80.0   
RRRM2_BRN_FLT_ISS-T_OLD_FO16            4050.0  29.0  0.0  29.0  29.0  29.0  29.0  29.0                             4050.0  37.0  0.0  37.0  37.0  37.0  37.0  37.0                    4050.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                      4050.0 -80.0  0.0 -80.0 -80.0   
RRRM2_BRN_GC_ISS-T_YNG_GY2              9651.0  12.0  0.0  12.0  12.0  12.0  12.0  12.0                             9651.0  20.0  0.0  20.0  20.0  20.0  20.0  20.0                    9651.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                      9651.0 -80.0  0.0 -80.0 -80.0   
RRRM2_BRN_FLT_ISS-T_YNG_FY5             3914.0  12.0  0.0  12.0  12.0  12.0  12.0  12.0                             3914.0  20.0  0.0  20.0  20.0  20.0  20.0  20.0                    3914.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0                                      3914.0 -80.0  0.0 -80.0 -80.0   

                                               n_cells_original_sample                                                            n_genes_by_counts                                                                    total_counts               ... _scvi_labels      leiden_resolution         \
                               50%   75%   max                   count     mean  std      min      25%      50%      75%      max             count         mean          std    min      25%     50%      75%     max        count         mean  ...          75%  max             count   mean   
sample                                                                                                                                                                                                                                            ...                                              
RRRM2_BRN_GC_ISS-T_YNG_GY4   -80.0 -80.0 -80.0                  7547.0   8542.0  0.0   8542.0   8542.0   8542.0   8542.0   8542.0            7547.0  1464.316152   814.740976  299.0   695.00  1367.0  2129.00  3735.0       7547.0  2414.633545  ...          0.0  0.0            7547.0  0.027   
RRRM2_BRN_GC_ISS-T_YNG_GY9   -80.0 -80.0 -80.0                  5465.0   6044.0  0.0   6044.0   6044.0   6044.0   6044.0   6044.0            5465.0  2703.472827  1308.060665  651.0  1328.00  2972.0  3683.00  5979.0       5465.0  3206.402588  ...          0.0  0.0            5465.0  0.027   
RRRM2_BRN_GC_ISS-T_OLD_GO18  -80.0 -80.0 -80.0                  5842.0   6503.0  0.0   6503.0   6503.0   6503.0   6503.0   6503.0            5842.0  1678.743923   875.860511  283.0   828.00  1768.0  2364.75  3987.0       5842.0  2547.017334  ...          0.0  0.0            5842.0  0.027   
RRRM2_BRN_FLT_ISS-T_OLD_FO20 -80.0 -80.0 -80.0                  4922.0   5641.0  0.0   5641.0   5641.0   5641.0   5641.0   5641.0            4922.0  2467.499187  1334.135315  554.0  1044.25  2718.0  3561.75  5628.0       4922.0  3051.313232  ...          0.0  0.0            4922.0  0.027   
RRRM2_BRN_GC_ISS-T_OLD_GO19  -80.0 -80.0 -80.0                  7539.0   8476.0  0.0   8476.0   8476.0   8476.0   8476.0   8476.0            7539.0  2632.348985  1279.054702  566.0  1238.00  2939.0  3594.50  5858.0       7539.0  3189.832764  ...          0.0  0.0            7539.0  0.027   
RRRM2_BRN_GC_ISS-T_OLD_GO13  -80.0 -80.0 -80.0                  3595.0   3880.0  0.0   3880.0   3880.0   3880.0   3880.0   3880.0            3595.0  2588.294298  1327.554343  776.0  1262.00  2583.0  3736.50  5590.0       3595.0  3141.175537  ...          0.0  0.0            3595.0  0.027   
RRRM2_BRN_FLT_ISS-T_YNG_FY8  -80.0 -80.0 -80.0                  5095.0   5658.0  0.0   5658.0   5658.0   5658.0   5658.0   5658.0            5095.0  2789.168008  1592.824136  466.0  1131.00  3043.0  4103.00  6776.0       5095.0  3192.124023  ...          0.0  0.0            5095.0  0.027   
RRRM2_BRN_FLT_ISS-T_YNG_FY7  -80.0 -80.0 -80.0                  3669.0   4238.0  0.0   4238.0   4238.0   4238.0   4238.0   4238.0            3669.0  1567.765604  1026.974124  314.0   547.00  1545.0  2370.00  4581.0       3669.0  2420.943115  ...          0.0  0.0            3669.0  0.027   
RRRM2_BRN_FLT_ISS-T_OLD_FO19 -80.0 -80.0 -80.0                  5747.0   7265.0  0.0   7265.0   7265.0   7265.0   7265.0   7265.0            5747.0  1814.084218  1156.099867  229.0   740.00  1444.0  2846.50  5441.0       5747.0  2634.590820  ...          0.0  0.0            5747.0  0.027   
RRRM2_BRN_GC_ISS-T_YNG_GY7   -80.0 -80.0 -80.0                  5265.0   5776.0  0.0   5776.0   5776.0   5776.0   5776.0   5776.0            5265.0  2760.520608  1430.739583  714.0  1265.00  2990.0  3947.00  6339.0       5265.0  3175.982910  ...          0.0  0.0            5265.0  0.027   
RRRM2_BRN_FLT_ISS-T_OLD_FO14 -80.0 -80.0 -80.0                  3864.0   4260.0  0.0   4260.0   4260.0   4260.0   4260.0   4260.0            3864.0  2855.340321  1495.520733  646.0  1258.00  3082.0  4091.00  6259.0       3864.0  3060.737061  ...          0.0  0.0            3864.0  0.027   
RRRM2_BRN_GC_ISS-T_YNG_GY1   -80.0 -80.0 -80.0                  3672.0   3968.0  0.0   3968.0   3968.0   3968.0   3968.0   3968.0            3672.0  3256.512255  1538.412658  886.0  1613.00  3539.5  4524.75  6742.0       3672.0  3294.314209  ...          0.0  0.0            3672.0  0.027   
RRRM2_BRN_FLT_ISS-T_YNG_FY2  -80.0 -80.0 -80.0                  3730.0   4125.0  0.0   4125.0   4125.0   4125.0   4125.0   4125.0            3730.0  3048.478284  1670.078189  678.0  1280.00  3367.0  4444.25  6825.0       3730.0  3182.537109  ...          0.0  0.0            3730.0  0.027   
RRRM2_BRN_FLT_ISS-T_OLD_FO17 -80.0 -80.0 -80.0                  1321.0   1493.0  0.0   1493.0   1493.0   1493.0   1493.0   1493.0            1321.0  1323.376230   889.224703  288.0   568.00   963.0  2069.00  3710.0       1321.0  2313.327881  ...          0.0  0.0            1321.0  0.027   
RRRM2_BRN_GC_ISS-T_OLD_GO16  -80.0 -80.0 -80.0                 18386.0  20000.0  0.0  20000.0  20000.0  20000.0  20000.0  20000.0           18386.0   996.987110   727.946972  222.0   485.25   719.0  1210.00  3853.0      18386.0  1968.417236  ...          0.0  0.0           18386.0  0.027   
RRRM2_BRN_FLT_ISS-T_OLD_FO16 -80.0 -80.0 -80.0                  4050.0   4863.0  0.0   4863.0   4863.0   4863.0   4863.0   4863.0            4050.0  3231.898025  1648.761929  733.0  1444.25  3502.0  4531.00  7088.0       4050.0  3264.440430  ...          0.0  0.0            4050.0  0.027   
RRRM2_BRN_GC_ISS-T_YNG_GY2   -80.0 -80.0 -80.0                  9651.0  10779.0  0.0  10779.0  10779.0  10779.0  10779.0  10779.0            9651.0  2324.572998  1335.997180  474.0   937.50  2433.0  3476.50  5920.0       9651.0  2870.699463  ...          0.0  0.0            9651.0  0.027   
RRRM2_BRN_FLT_ISS-T_YNG_FY5  -80.0 -80.0 -80.0                  3914.0   4714.0  0.0   4714.0   4714.0   4714.0   4714.0   4714.0            3914.0  3249.220235  1517.653371  750.0  1620.00  3660.0  4410.75  6690.0       3914.0  3328.487061  ...          0.0  0.0            3914.0  0.027   

                                                                              leiden_n_neighbors                                          leiden_min_dist                                             majority_voting_probabilities                                                                       \
                                       std    min    25%    50%    75%    max              count  mean  std   min   25%   50%   75%   max           count mean           std  min  25%  50%  75%  max                         count      mean       std           min       25%       50%       75%  max   
sample                                                                                                                                                                                                                                                                                                     
RRRM2_BRN_GC_ISS-T_YNG_GY4    6.939354e-18  0.027  0.027  0.027  0.027  0.027             7547.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0          7547.0  1.3  2.220593e-16  1.3  1.3  1.3  1.3  1.3                        5835.0  0.731971  0.351949  3.984064e-08  0.516274  0.938839  0.994447  1.0   
RRRM2_BRN_GC_ISS-T_YNG_GY9    0.000000e+00  0.027  0.027  0.027  0.027  0.027             5465.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0          5465.0  1.3  2.220649e-16  1.3  1.3  1.3  1.3  1.3                        4925.0  0.806628  0.327564  8.496158e-09  0.812519  0.983840  0.998867  1.0   
RRRM2_BRN_GC_ISS-T_OLD_GO18   6.939488e-18  0.027  0.027  0.027  0.027  0.027             5842.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0          5842.0  1.3  2.220636e-16  1.3  1.3  1.3  1.3  1.3                        5473.0  0.758686  0.337174  9.971479e-09  0.596715  0.955063  0.994763  1.0   
RRRM2_BRN_FLT_ISS-T_OLD_FO20  0.000000e+00  0.027  0.027  0.027  0.027  0.027             4922.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0          4922.0  1.3  0.000000e+00  1.3  1.3  1.3  1.3  1.3                        4701.0  0.808096  0.318233  1.434228e-07  0.781311  0.982027  0.998164  1.0   
RRRM2_BRN_GC_ISS-T_OLD_GO19   6.939354e-18  0.027  0.027  0.027  0.027  0.027             7539.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0          7539.0  1.3  2.220593e-16  1.3  1.3  1.3  1.3  1.3                        6966.0  0.820181  0.316532  1.130676e-08  0.843462  0.985896  0.998742  1.0   
RRRM2_BRN_GC_ISS-T_OLD_GO13   6.939859e-18  0.027  0.027  0.027  0.027  0.027             3595.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0          3595.0  1.3  2.220755e-16  1.3  1.3  1.3  1.3  1.3                        3162.0  0.853210  0.302856  9.360477e-11  0.928778  0.996575  0.999885  1.0   
RRRM2_BRN_FLT_ISS-T_YNG_FY8   0.000000e+00  0.027  0.027  0.027  0.027  0.027             5095.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0          5095.0  1.3  2.220664e-16  1.3  1.3  1.3  1.3  1.3                        4293.0  0.803511  0.333032  3.633419e-06  0.799202  0.988764  0.999306  1.0   
RRRM2_BRN_FLT_ISS-T_YNG_FY7   1.387968e-17  0.027  0.027  0.027  0.027  0.027             3669.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0          3669.0  1.3  2.220749e-16  1.3  1.3  1.3  1.3  1.3                        3285.0  0.732524  0.345319  3.307532e-05  0.515515  0.934969  0.993638  1.0   
RRRM2_BRN_FLT_ISS-T_OLD_FO19  6.939498e-18  0.027  0.027  0.027  0.027  0.027             5747.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0          5747.0  1.3  4.441279e-16  1.3  1.3  1.3  1.3  1.3                        3965.0  0.800322  0.329155  8.450188e-09  0.779898  0.979764  0.997917  1.0   
RRRM2_BRN_GC_ISS-T_YNG_GY7    6.939553e-18  0.027  0.027  0.027  0.027  0.027             5265.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0          5265.0  1.3  2.220657e-16  1.3  1.3  1.3  1.3  1.3                        4612.0  0.844319  0.301817  4.859075e-09  0.900802  0.993400  0.999571  1.0   
RRRM2_BRN_FLT_ISS-T_OLD_FO14  6.939792e-18  0.027  0.027  0.027  0.027  0.027             3864.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0          3864.0  1.3  2.220733e-16  1.3  1.3  1.3  1.3  1.3                        3635.0  0.834795  0.306314  1.359645e-11  0.878763  0.990592  0.999394  1.0   
RRRM2_BRN_GC_ISS-T_YNG_GY1    1.040976e-17  0.027  0.027  0.027  0.027  0.027             3672.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0          3672.0  1.3  0.000000e+00  1.3  1.3  1.3  1.3  1.3                        3283.0  0.818317  0.319496  1.352452e-08  0.840154  0.989572  0.999468  1.0   
RRRM2_BRN_FLT_ISS-T_YNG_FY2   1.040974e-17  0.027  0.027  0.027  0.027  0.027             3730.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0          3730.0  1.3  0.000000e+00  1.3  1.3  1.3  1.3  1.3                        3402.0  0.818877  0.325189  1.072093e-07  0.842627  0.989798  0.999319  1.0   
RRRM2_BRN_FLT_ISS-T_OLD_FO17  0.000000e+00  0.027  0.027  0.027  0.027  0.027             1321.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0          1321.0  1.3  2.221287e-16  1.3  1.3  1.3  1.3  1.3                         615.0  0.759735  0.344848  1.527736e-05  0.634516  0.963477  0.996633  1.0   
RRRM2_BRN_GC_ISS-T_OLD_GO16   1.040862e-17  0.027  0.027  0.027  0.027  0.027            18386.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0         18386.0  1.3  2.220506e-16  1.3  1.3  1.3  1.3  1.3                        5851.0  0.731904  0.348553  6.960821e-07  0.502938  0.938182  0.993427  1.0   
RRRM2_BRN_FLT_ISS-T_OLD_FO16  6.939751e-18  0.027  0.027  0.027  0.027  0.027             4050.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0          4050.0  1.3  2.220720e-16  1.3  1.3  1.3  1.3  1.3                        3678.0  0.816042  0.326740  7.075571e-06  0.847619  0.988311  0.999079  1.0   
RRRM2_BRN_GC_ISS-T_YNG_GY2    1.040888e-17  0.027  0.027  0.027  0.027  0.027             9651.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0          9651.0  1.3  2.220561e-16  1.3  1.3  1.3  1.3  1.3                        8842.0  0.810352  0.312684  3.324217e-09  0.787407  0.980535  0.998094  1.0   
RRRM2_BRN_FLT_ISS-T_YNG_FY5   1.040967e-17  0.027  0.027  0.027  0.027  0.027             3914.0  40.0  0.0  40.0  40.0  40.0  40.0  40.0          3914.0  1.3  2.220730e-16  1.3  1.3  1.3  1.3  1.3                        3714.0  0.844041  0.290406  1.649057e-06  0.878605  0.988782  0.998847  1.0   

                             Spaceflight                                        Aged                                     
                                   count mean  std  min  25%  50%  75%  max    count mean  std  min  25%  50%  75%  max  
sample                                                                                                                   
RRRM2_BRN_GC_ISS-T_YNG_GY4        7547.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   7547.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
RRRM2_BRN_GC_ISS-T_YNG_GY9        5465.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   5465.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
RRRM2_BRN_GC_ISS-T_OLD_GO18       5842.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   5842.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
RRRM2_BRN_FLT_ISS-T_OLD_FO20      4922.0  1.0  0.0  1.0  1.0  1.0  1.0  1.0   4922.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
RRRM2_BRN_GC_ISS-T_OLD_GO19       7539.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   7539.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
RRRM2_BRN_GC_ISS-T_OLD_GO13       3595.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   3595.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
RRRM2_BRN_FLT_ISS-T_YNG_FY8       5095.0  1.0  0.0  1.0  1.0  1.0  1.0  1.0   5095.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
RRRM2_BRN_FLT_ISS-T_YNG_FY7       3669.0  1.0  0.0  1.0  1.0  1.0  1.0  1.0   3669.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
RRRM2_BRN_FLT_ISS-T_OLD_FO19      5747.0  1.0  0.0  1.0  1.0  1.0  1.0  1.0   5747.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
RRRM2_BRN_GC_ISS-T_YNG_GY7        5265.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   5265.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
RRRM2_BRN_FLT_ISS-T_OLD_FO14      3864.0  1.0  0.0  1.0  1.0  1.0  1.0  1.0   3864.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
RRRM2_BRN_GC_ISS-T_YNG_GY1        3672.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   3672.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
RRRM2_BRN_FLT_ISS-T_YNG_FY2       3730.0  1.0  0.0  1.0  1.0  1.0  1.0  1.0   3730.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
RRRM2_BRN_FLT_ISS-T_OLD_FO17      1321.0  1.0  0.0  1.0  1.0  1.0  1.0  1.0   1321.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
RRRM2_BRN_GC_ISS-T_OLD_GO16      18386.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  18386.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
RRRM2_BRN_FLT_ISS-T_OLD_FO16      4050.0  1.0  0.0  1.0  1.0  1.0  1.0  1.0   4050.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
RRRM2_BRN_GC_ISS-T_YNG_GY2        9651.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0   9651.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
RRRM2_BRN_FLT_ISS-T_YNG_FY5       3914.0  1.0  0.0  1.0  1.0  1.0  1.0  1.0   3914.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  

[18 rows x 248 columns]
Out[ ]:
Group sample Characteristics[Organism] Term Source REF Term Accession Number Characteristics[Strain] Term Source REF.1 Term Accession Number.1 Characteristics[Genotype] Term Source REF.2 Term Accession Number.2 Characteristics[Animal Source] Characteristics[Sex] Term Source REF.3 Term Accession Number.3 Factor Value[Spaceflight] Term Source REF.4 Term Accession Number.4 Factor Value[Age] Unit Term Source REF.5 Term Accession Number.5 Characteristics[Material Type] Term Source REF.6 Term Accession Number.6 Characteristics[diet] Characteristics[Feeding Schedule] Characteristics[Age at Euthanasia] Unit.1 Term Source REF.7 Term Accession Number.7 Protocol REF Parameter Value[habitat] Parameter Value[Enrichment material] Parameter Value[duration] Unit.2 Term Source REF.8 Term Accession Number.8 Parameter Value[light cycle] Protocol REF.1 Parameter Value[Euthanasia Method] Parameter Value[Sample Preservation Method] Term Source REF.9 Term Accession Number.9 Parameter Value[Sample Storage Temperature] Unit.3 Term Source REF.10 Term Accession Number.10 Comment[RFID] Comment[Euthanasia Date] ... min_max_genes min_max_cells max_mt min_max_counts zero_center max_value doublet_detection n_genes_by_counts total_counts log1p_n_genes_by_counts log1p_total_counts total_counts_mt pct_counts_mt log1p_total_counts_mt total_counts_ribo pct_counts_ribo log1p_total_counts_ribo total_counts_hb pct_counts_hb log1p_total_counts_hb n_counts n_genes doublet_score predicted_doublet resolution_individual min_dist_individual leiden_individual annotation_by_markers_individual annotation_by_markers_individual_heterogeneous_collapsed _scvi_batch _scvi_labels annotation_scanvi kws_integrate leiden leiden_resolution leiden_n_neighbors leiden_min_dist annotation_by_overlap annotation_toppgene predicted_labels majority_voting majority_voting_probabilities majority_voting_short annotation_majority_voting Age_Start Age_End Condition Spaceflight Aged annotation_by_overlap_hierarchy
AAACAGCCAATCGCAC-1_RRRM2_BRN_GC_ISS-T_YNG_GY4 Ground Control | 12 Weeks RRRM2_BRN_GC_ISS-T_YNG_GY4 Mus musculus NCBITAXON http://purl.bioontology.org/ontology/NCBITAXON/10090 C57BL/6NTac EFO http://www.ebi.ac.uk/efo/EFO_0020093 Wild Type NCIT http://purl.obolibrary.org/obo/NCIT_C62195 Taconic Biosciences Female MESH http://purl.bioontology.org/ontology/MESH/D005260 Ground Control OSD https://osdr.nasa.gov/ 12 week UO http://purl.obolibrary.org/obo/UO_0000034 Left cerebral hemisphere FMA http://purl.org/sig/ont/fma/fma61819 Nutrient Upgraded Rodent Food Bar (NuRFB) ad libitum 20 week UO http://purl.obolibrary.org/obo/UO_0000034 Animal Husbandry Rodent Flight Hardware (Transporter and Habitat) Hut 53 day UO http://purl.obolibrary.org/obo/UO_0000033 12 h light/dark cycle sample collection Bilateral thoracotomy with sedation, Cardiac puncture with sedation, Ketamine/xylazine injection Liquid Nitrogen NCIT http://purl.obolibrary.org/obo/NCIT_C68796 -80 degree Celsius UO http://purl.obolibrary.org/obo/UO_0000027 6E2A671967 18-Sep-2019 ... [321.0, None] [20, None] 10 [414.0, 11122.175000000005] True 10 drop 2074 2960.899414 7.637716 7.993586 13.329097 0.450171 2.662292 10.466295 0.353484 2.439412 1.618296 0.054656 0.962524 4962.0 2152 0.030852 False 0.15 1.5 2 Excitatory Excitatory 0 0 Excitatory {'col_celltype': 'annotation_by_markers_individual_heterogeneous_collapsed', 'flavor': 'scanvi',... 2 0.027 40 1.3 Excitatory Excitatory 006 L4/5 IT CTX Glut 006 L4/5 IT CTX Glut 0.834218 L4/5 IT CTX Glut Glutamatergic 12 Weeks 20 Weeks Ground Control 0 0 Neuron
AAACAGCCAGCACCAT-1_RRRM2_BRN_GC_ISS-T_YNG_GY4 Ground Control | 12 Weeks RRRM2_BRN_GC_ISS-T_YNG_GY4 Mus musculus NCBITAXON http://purl.bioontology.org/ontology/NCBITAXON/10090 C57BL/6NTac EFO http://www.ebi.ac.uk/efo/EFO_0020093 Wild Type NCIT http://purl.obolibrary.org/obo/NCIT_C62195 Taconic Biosciences Female MESH http://purl.bioontology.org/ontology/MESH/D005260 Ground Control OSD https://osdr.nasa.gov/ 12 week UO http://purl.obolibrary.org/obo/UO_0000034 Left cerebral hemisphere FMA http://purl.org/sig/ont/fma/fma61819 Nutrient Upgraded Rodent Food Bar (NuRFB) ad libitum 20 week UO http://purl.obolibrary.org/obo/UO_0000034 Animal Husbandry Rodent Flight Hardware (Transporter and Habitat) Hut 53 day UO http://purl.obolibrary.org/obo/UO_0000033 12 h light/dark cycle sample collection Bilateral thoracotomy with sedation, Cardiac puncture with sedation, Ketamine/xylazine injection Liquid Nitrogen NCIT http://purl.obolibrary.org/obo/NCIT_C68796 -80 degree Celsius UO http://purl.obolibrary.org/obo/UO_0000027 6E2A671967 18-Sep-2019 ... [321.0, None] [20, None] 10 [414.0, 11122.175000000005] True 10 drop 1568 2710.792725 7.358194 7.905365 13.841085 0.510592 2.697399 13.840614 0.510574 2.697368 1.474337 0.054388 0.905972 2994.0 1636 0.052691 False 0.15 1.5 12 Excitatory Excitatory 0 0 Excitatory {'col_celltype': 'annotation_by_markers_individual_heterogeneous_collapsed', 'flavor': 'scanvi',... 10 0.027 40 1.3 Excitatory-Inhibitory Excitatory 149 PVT-PT Ntrk1 Glut 150 CM-IAD-CL-PCN Sema5b Glut 0.000921 CM-IAD-CL-PCN Sema5b Glut Glutamatergic 12 Weeks 20 Weeks Ground Control 0 0 Neuron
AAACAGCCAGGTTCAC-1_RRRM2_BRN_GC_ISS-T_YNG_GY4 Ground Control | 12 Weeks RRRM2_BRN_GC_ISS-T_YNG_GY4 Mus musculus NCBITAXON http://purl.bioontology.org/ontology/NCBITAXON/10090 C57BL/6NTac EFO http://www.ebi.ac.uk/efo/EFO_0020093 Wild Type NCIT http://purl.obolibrary.org/obo/NCIT_C62195 Taconic Biosciences Female MESH http://purl.bioontology.org/ontology/MESH/D005260 Ground Control OSD https://osdr.nasa.gov/ 12 week UO http://purl.obolibrary.org/obo/UO_0000034 Left cerebral hemisphere FMA http://purl.org/sig/ont/fma/fma61819 Nutrient Upgraded Rodent Food Bar (NuRFB) ad libitum 20 week UO http://purl.obolibrary.org/obo/UO_0000034 Animal Husbandry Rodent Flight Hardware (Transporter and Habitat) Hut 53 day UO http://purl.obolibrary.org/obo/UO_0000033 12 h light/dark cycle sample collection Bilateral thoracotomy with sedation, Cardiac puncture with sedation, Ketamine/xylazine injection Liquid Nitrogen NCIT http://purl.obolibrary.org/obo/NCIT_C68796 -80 degree Celsius UO http://purl.obolibrary.org/obo/UO_0000027 6E2A671967 18-Sep-2019 ... [321.0, None] [20, None] 10 [414.0, 11122.175000000005] True 10 drop 2953 3351.134033 7.990915 8.117352 1.542924 0.046042 0.933315 8.764180 0.261529 2.278721 0.000000 0.000000 0.000000 8625.0 3080 0.014899 False 0.15 1.5 7 Excitatory Excitatory 0 0 Excitatory {'col_celltype': 'annotation_by_markers_individual_heterogeneous_collapsed', 'flavor': 'scanvi',... 7 0.027 40 1.3 Excitatory Excitatory 029 L6b CTX Glut 029 L6b CTX Glut 0.331972 L6b CTX Glut Glutamatergic 12 Weeks 20 Weeks Ground Control 0 0 Neuron
AAACAGCCATCAATCG-1_RRRM2_BRN_GC_ISS-T_YNG_GY4 Ground Control | 12 Weeks RRRM2_BRN_GC_ISS-T_YNG_GY4 Mus musculus NCBITAXON http://purl.bioontology.org/ontology/NCBITAXON/10090 C57BL/6NTac EFO http://www.ebi.ac.uk/efo/EFO_0020093 Wild Type NCIT http://purl.obolibrary.org/obo/NCIT_C62195 Taconic Biosciences Female MESH http://purl.bioontology.org/ontology/MESH/D005260 Ground Control OSD https://osdr.nasa.gov/ 12 week UO http://purl.obolibrary.org/obo/UO_0000034 Left cerebral hemisphere FMA http://purl.org/sig/ont/fma/fma61819 Nutrient Upgraded Rodent Food Bar (NuRFB) ad libitum 20 week UO http://purl.obolibrary.org/obo/UO_0000034 Animal Husbandry Rodent Flight Hardware (Transporter and Habitat) Hut 53 day UO http://purl.obolibrary.org/obo/UO_0000033 12 h light/dark cycle sample collection Bilateral thoracotomy with sedation, Cardiac puncture with sedation, Ketamine/xylazine injection Liquid Nitrogen NCIT http://purl.obolibrary.org/obo/NCIT_C68796 -80 degree Celsius UO http://purl.obolibrary.org/obo/UO_0000027 6E2A671967 18-Sep-2019 ... [321.0, None] [20, None] 10 [414.0, 11122.175000000005] True 10 drop 1071 2206.367188 6.977281 7.699556 5.162194 0.233968 1.818433 8.940096 0.405195 2.296577 0.000000 0.000000 0.000000 2017.0 1116 0.018405 False 0.15 1.5 8 Oligodendrocyte Oligodendrocyte 0 0 Oligodendrocyte {'col_celltype': 'annotation_by_markers_individual_heterogeneous_collapsed', 'flavor': 'scanvi',... 5 0.027 40 1.3 Oligodendrocyte Oligodendrocyte 327 Oligo NN 327 Oligo NN 0.999615 Oligo NN Oligodendrocyte 12 Weeks 20 Weeks Ground Control 0 0 Macroglia
AAACAGCCATGTCAAT-1_RRRM2_BRN_GC_ISS-T_YNG_GY4 Ground Control | 12 Weeks RRRM2_BRN_GC_ISS-T_YNG_GY4 Mus musculus NCBITAXON http://purl.bioontology.org/ontology/NCBITAXON/10090 C57BL/6NTac EFO http://www.ebi.ac.uk/efo/EFO_0020093 Wild Type NCIT http://purl.obolibrary.org/obo/NCIT_C62195 Taconic Biosciences Female MESH http://purl.bioontology.org/ontology/MESH/D005260 Ground Control OSD https://osdr.nasa.gov/ 12 week UO http://purl.obolibrary.org/obo/UO_0000034 Left cerebral hemisphere FMA http://purl.org/sig/ont/fma/fma61819 Nutrient Upgraded Rodent Food Bar (NuRFB) ad libitum 20 week UO http://purl.obolibrary.org/obo/UO_0000034 Animal Husbandry Rodent Flight Hardware (Transporter and Habitat) Hut 53 day UO http://purl.obolibrary.org/obo/UO_0000033 12 h light/dark cycle sample collection Bilateral thoracotomy with sedation, Cardiac puncture with sedation, Ketamine/xylazine injection Liquid Nitrogen NCIT http://purl.obolibrary.org/obo/NCIT_C68796 -80 degree Celsius UO http://purl.obolibrary.org/obo/UO_0000027 6E2A671967 18-Sep-2019 ... [321.0, None] [20, None] 10 [414.0, 11122.175000000005] True 10 drop 2527 3219.782959 7.835184 8.077380 7.173846 0.222805 2.100940 9.022173 0.280211 2.304800 0.000000 0.000000 0.000000 6688.0 2614 0.004741 False 0.15 1.5 7 Excitatory Excitatory 0 0 Excitatory {'col_celltype': 'annotation_by_markers_individual_heterogeneous_collapsed', 'flavor': 'scanvi',... 7 0.027 40 1.3 Excitatory Excitatory 030 L6 CT CTX Glut 030 L6 CT CTX Glut 0.995431 L6 CT CTX Glut Glutamatergic 12 Weeks 20 Weeks Ground Control 0 0 Neuron
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
TTTGTGTTCCCTGATC-1_RRRM2_BRN_FLT_ISS-T_YNG_FY5 Space Flight | 12 Weeks RRRM2_BRN_FLT_ISS-T_YNG_FY5 Mus musculus NCBITAXON http://purl.bioontology.org/ontology/NCBITAXON/10090 C57BL/6NTac EFO http://www.ebi.ac.uk/efo/EFO_0020093 Wild Type NCIT http://purl.obolibrary.org/obo/NCIT_C62195 Taconic Biosciences Female MESH http://purl.bioontology.org/ontology/MESH/D005260 Space Flight MESH http://purl.bioontology.org/ontology/MESH/D013026 12 week UO http://purl.obolibrary.org/obo/UO_0000034 Left cerebral hemisphere FMA http://purl.org/sig/ont/fma/fma61819 Nutrient Upgraded Rodent Food Bar (NuRFB) ad libitum 20 week UO http://purl.obolibrary.org/obo/UO_0000034 Animal Husbandry Rodent Flight Hardware (Transporter and Habitat) Hut 53 day UO http://purl.obolibrary.org/obo/UO_0000033 12 h light/dark cycle sample collection Bilateral thoracotomy with sedation, Cardiac puncture with sedation, Ketamine/xylazine injection Cryochiller OSD https://osdr.nasa.gov/ -80 degree Celsius UO http://purl.obolibrary.org/obo/UO_0000027 6E3E102A12 16-Sep-2019 ... [809.825, None] [20, None] 10 [1300.3, 32231.825000000015] True 10 drop 3951 3698.035645 8.281977 8.215827 15.195225 0.410900 2.784716 32.415512 0.876560 3.509020 0.000000 0.000000 0.000000 12819.0 4151 0.006702 False 0.15 1.5 5 Excitatory-Inhibitory Excitatory-Inhibitory 17 0 Excitatory-Inhibitory {'col_celltype': 'annotation_by_markers_individual_heterogeneous_collapsed', 'flavor': 'scanvi',... 7 0.027 40 1.3 Excitatory Excitatory 030 L6 CT CTX Glut 030 L6 CT CTX Glut 0.651805 L6 CT CTX Glut Glutamatergic 12 Weeks 20 Weeks Space Flight 1 0 Neuron
TTTGTGTTCCGTAAAC-1_RRRM2_BRN_FLT_ISS-T_YNG_FY5 Space Flight | 12 Weeks RRRM2_BRN_FLT_ISS-T_YNG_FY5 Mus musculus NCBITAXON http://purl.bioontology.org/ontology/NCBITAXON/10090 C57BL/6NTac EFO http://www.ebi.ac.uk/efo/EFO_0020093 Wild Type NCIT http://purl.obolibrary.org/obo/NCIT_C62195 Taconic Biosciences Female MESH http://purl.bioontology.org/ontology/MESH/D005260 Space Flight MESH http://purl.bioontology.org/ontology/MESH/D013026 12 week UO http://purl.obolibrary.org/obo/UO_0000034 Left cerebral hemisphere FMA http://purl.org/sig/ont/fma/fma61819 Nutrient Upgraded Rodent Food Bar (NuRFB) ad libitum 20 week UO http://purl.obolibrary.org/obo/UO_0000034 Animal Husbandry Rodent Flight Hardware (Transporter and Habitat) Hut 53 day UO http://purl.obolibrary.org/obo/UO_0000033 12 h light/dark cycle sample collection Bilateral thoracotomy with sedation, Cardiac puncture with sedation, Ketamine/xylazine injection Cryochiller OSD https://osdr.nasa.gov/ -80 degree Celsius UO http://purl.obolibrary.org/obo/UO_0000027 6E3E102A12 16-Sep-2019 ... [809.825, None] [20, None] 10 [1300.3, 32231.825000000015] True 10 drop 4371 3844.071045 8.382976 8.254547 10.088642 0.262447 2.405921 46.482113 1.209190 3.860353 0.498700 0.012973 0.404598 15502.0 4645 0.007560 False 0.15 1.5 3 Excitatory Excitatory 17 0 Excitatory {'col_celltype': 'annotation_by_markers_individual_heterogeneous_collapsed', 'flavor': 'scanvi',... 2 0.027 40 1.3 Excitatory Excitatory 016 CA1-ProS Glut 017 CA3 Glut 0.023398 CA3 Glut Glutamatergic 12 Weeks 20 Weeks Space Flight 1 0 Neuron
TTTGTGTTCTGTGCAG-1_RRRM2_BRN_FLT_ISS-T_YNG_FY5 Space Flight | 12 Weeks RRRM2_BRN_FLT_ISS-T_YNG_FY5 Mus musculus NCBITAXON http://purl.bioontology.org/ontology/NCBITAXON/10090 C57BL/6NTac EFO http://www.ebi.ac.uk/efo/EFO_0020093 Wild Type NCIT http://purl.obolibrary.org/obo/NCIT_C62195 Taconic Biosciences Female MESH http://purl.bioontology.org/ontology/MESH/D005260 Space Flight MESH http://purl.bioontology.org/ontology/MESH/D013026 12 week UO http://purl.obolibrary.org/obo/UO_0000034 Left cerebral hemisphere FMA http://purl.org/sig/ont/fma/fma61819 Nutrient Upgraded Rodent Food Bar (NuRFB) ad libitum 20 week UO http://purl.obolibrary.org/obo/UO_0000034 Animal Husbandry Rodent Flight Hardware (Transporter and Habitat) Hut 53 day UO http://purl.obolibrary.org/obo/UO_0000033 12 h light/dark cycle sample collection Bilateral thoracotomy with sedation, Cardiac puncture with sedation, Ketamine/xylazine injection Cryochiller OSD https://osdr.nasa.gov/ -80 degree Celsius UO http://purl.obolibrary.org/obo/UO_0000027 6E3E102A12 16-Sep-2019 ... [809.825, None] [20, None] 10 [1300.3, 32231.825000000015] True 10 drop 5541 3862.635010 8.620111 8.259364 17.424606 0.451107 2.913687 27.956829 0.723776 3.365806 0.000000 0.000000 0.000000 27623.0 5886 0.035294 False 0.15 1.5 1 Excitatory Excitatory 17 0 Excitatory {'col_celltype': 'annotation_by_markers_individual_heterogeneous_collapsed', 'flavor': 'scanvi',... 2 0.027 40 1.3 Excitatory Excitatory 006 L4/5 IT CTX Glut 006 L4/5 IT CTX Glut 0.823794 L4/5 IT CTX Glut Glutamatergic 12 Weeks 20 Weeks Space Flight 1 0 Neuron
TTTGTTGGTGTTAGCA-1_RRRM2_BRN_FLT_ISS-T_YNG_FY5 Space Flight | 12 Weeks RRRM2_BRN_FLT_ISS-T_YNG_FY5 Mus musculus NCBITAXON http://purl.bioontology.org/ontology/NCBITAXON/10090 C57BL/6NTac EFO http://www.ebi.ac.uk/efo/EFO_0020093 Wild Type NCIT http://purl.obolibrary.org/obo/NCIT_C62195 Taconic Biosciences Female MESH http://purl.bioontology.org/ontology/MESH/D005260 Space Flight MESH http://purl.bioontology.org/ontology/MESH/D013026 12 week UO http://purl.obolibrary.org/obo/UO_0000034 Left cerebral hemisphere FMA http://purl.org/sig/ont/fma/fma61819 Nutrient Upgraded Rodent Food Bar (NuRFB) ad libitum 20 week UO http://purl.obolibrary.org/obo/UO_0000034 Animal Husbandry Rodent Flight Hardware (Transporter and Habitat) Hut 53 day UO http://purl.obolibrary.org/obo/UO_0000033 12 h light/dark cycle sample collection Bilateral thoracotomy with sedation, Cardiac puncture with sedation, Ketamine/xylazine injection Cryochiller OSD https://osdr.nasa.gov/ -80 degree Celsius UO http://purl.obolibrary.org/obo/UO_0000027 6E3E102A12 16-Sep-2019 ... [809.825, None] [20, None] 10 [1300.3, 32231.825000000015] True 10 drop 845 1923.521484 6.740519 7.562433 24.807867 1.289711 3.250679 28.636005 1.488728 3.388990 0.000000 0.000000 0.000000 1469.0 873 0.007560 False 0.15 1.5 8 Oligodendrocyte Oligodendrocyte 17 0 Oligodendrocyte {'col_celltype': 'annotation_by_markers_individual_heterogeneous_collapsed', 'flavor': 'scanvi',... 5 0.027 40 1.3 Oligodendrocyte Oligodendrocyte 327 Oligo NN 327 Oligo NN 0.993974 Oligo NN Oligodendrocyte 12 Weeks 20 Weeks Space Flight 1 0 Macroglia
TTTGTTGGTTAAGTGT-1_RRRM2_BRN_FLT_ISS-T_YNG_FY5 Space Flight | 12 Weeks RRRM2_BRN_FLT_ISS-T_YNG_FY5 Mus musculus NCBITAXON http://purl.bioontology.org/ontology/NCBITAXON/10090 C57BL/6NTac EFO http://www.ebi.ac.uk/efo/EFO_0020093 Wild Type NCIT http://purl.obolibrary.org/obo/NCIT_C62195 Taconic Biosciences Female MESH http://purl.bioontology.org/ontology/MESH/D005260 Space Flight MESH http://purl.bioontology.org/ontology/MESH/D013026 12 week UO http://purl.obolibrary.org/obo/UO_0000034 Left cerebral hemisphere FMA http://purl.org/sig/ont/fma/fma61819 Nutrient Upgraded Rodent Food Bar (NuRFB) ad libitum 20 week UO http://purl.obolibrary.org/obo/UO_0000034 Animal Husbandry Rodent Flight Hardware (Transporter and Habitat) Hut 53 day UO http://purl.obolibrary.org/obo/UO_0000033 12 h light/dark cycle sample collection Bilateral thoracotomy with sedation, Cardiac puncture with sedation, Ketamine/xylazine injection Cryochiller OSD https://osdr.nasa.gov/ -80 degree Celsius UO http://purl.obolibrary.org/obo/UO_0000027 6E3E102A12 16-Sep-2019 ... [809.825, None] [20, None] 10 [1300.3, 32231.825000000015] True 10 drop 3268 3583.923096 8.092239 8.184492 7.856516 0.219216 2.181154 28.247156 0.788163 3.375782 1.151552 0.032131 0.766189 9258.0 3411 0.058924 False 0.15 1.5 1 Excitatory Excitatory 17 0 Excitatory {'col_celltype': 'annotation_by_markers_individual_heterogeneous_collapsed', 'flavor': 'scanvi',... 2 0.027 40 1.3 Excitatory Excitatory 006 L4/5 IT CTX Glut 006 L4/5 IT CTX Glut 0.961207 L4/5 IT CTX Glut Glutamatergic 12 Weeks 20 Weeks Space Flight 1 0 Neuron

103274 rows × 101 columns

Data Descriptives¶

In [37]:
%matplotlib inline

# Detect Metadata Columns in AnnData Object
metadata_cols = self.rna.obs.groupby(col_sample).apply(
    lambda x: list(x.columns[np.where(
        x.apply(lambda y: len(y.unique()) ==  1))[0]]))
metadata_cols = [x for x in metadata_cols.explode().unique() if all((
    x in metadata_cols.loc[i] for i in metadata_cols.index.values))]

# Value Counts for Categorical Variables
metadata_cols_category = self.rna.obs[metadata_cols].dtypes[((
    self.rna.obs[metadata_cols].dtypes == "category") | (self.rna.obs[
        metadata_cols].apply(lambda x: len(x.unique()) < 6))) & (self.rna.obs[
            metadata_cols].apply(lambda x: len(x.unique()) > 1))].index
for x in metadata_cols_category:
    print(x, "\n\n", self.rna.obs[x].value_counts(), "\n\n")
    if col_batch is not None:  # by batch
        if x != col_batch:
            print(x, "\n\n", self.rna.obs[[x, col_batch]].groupby(
                col_batch).value_counts(), "\n\n")

# Descriptives for Continuous Variables
print(self.rna.obs[self.rna.obs.columns.difference(
    metadata_cols_category)].describe())
if col_batch is not None:  # by batch
    print(self.rna.obs[list(self.rna.obs.columns.difference(
        metadata_cols_category)) + [col_batch]].groupby(col_batch).describe())

# Cells per Cluster
perc_clusters = round(100 * self.rna.obs.groupby(col_sample).value_counts(
    [col_celltype], normalize=True).unstack(1), 2)
print(f"\n\n*** Cell Composition (%) ***\n\n{perc_clusters}")

# Number of Cells
n_cells = self.rna.obs.groupby(col_sample).apply(
    lambda x: x.n_cells_original_sample.unique()[0],
    include_groups=False).to_frame("Original Cell N").join(
        self.rna.obs.groupby(col_sample).apply(
            lambda x: x.shape[0], include_groups=False).to_frame("N Cells"))
n_cells.loc[:, "Percent_Filtered"] = round(100 * (1 - n_cells[
    "N Cells"] / n_cells["Original Cell N"]), 2)
print("\n\n", n_cells.sort_values("Percent_Filtered"))
/tmp/ipykernel_33560/1416146960.py:4: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  metadata_cols = self.rna.obs.groupby(col_sample).apply(
Group 

 Group
Ground Control | 29 Weeks    35362
Ground Control | 12 Weeks    31600
Space Flight | 29 Weeks      19904
Space Flight | 12 Weeks      16408
Name: count, dtype: int64 


sample 

 sample
RRRM2_BRN_GC_ISS-T_OLD_GO16     18386
RRRM2_BRN_GC_ISS-T_YNG_GY2       9651
RRRM2_BRN_GC_ISS-T_YNG_GY4       7547
RRRM2_BRN_GC_ISS-T_OLD_GO19      7539
RRRM2_BRN_GC_ISS-T_OLD_GO18      5842
RRRM2_BRN_FLT_ISS-T_OLD_FO19     5747
RRRM2_BRN_GC_ISS-T_YNG_GY9       5465
RRRM2_BRN_GC_ISS-T_YNG_GY7       5265
RRRM2_BRN_FLT_ISS-T_YNG_FY8      5095
RRRM2_BRN_FLT_ISS-T_OLD_FO20     4922
RRRM2_BRN_FLT_ISS-T_OLD_FO16     4050
RRRM2_BRN_FLT_ISS-T_YNG_FY5      3914
RRRM2_BRN_FLT_ISS-T_OLD_FO14     3864
RRRM2_BRN_FLT_ISS-T_YNG_FY2      3730
RRRM2_BRN_GC_ISS-T_YNG_GY1       3672
RRRM2_BRN_FLT_ISS-T_YNG_FY7      3669
RRRM2_BRN_GC_ISS-T_OLD_GO13      3595
RRRM2_BRN_FLT_ISS-T_OLD_FO17     1321
Name: count, dtype: int64 


sample 

 Group                      sample                      
Ground Control | 12 Weeks  RRRM2_BRN_GC_ISS-T_YNG_GY2       9651
                           RRRM2_BRN_GC_ISS-T_YNG_GY4       7547
                           RRRM2_BRN_GC_ISS-T_YNG_GY9       5465
                           RRRM2_BRN_GC_ISS-T_YNG_GY7       5265
                           RRRM2_BRN_GC_ISS-T_YNG_GY1       3672
                           RRRM2_BRN_GC_ISS-T_OLD_GO18         0
                           RRRM2_BRN_FLT_ISS-T_OLD_FO20        0
                           RRRM2_BRN_GC_ISS-T_OLD_GO19         0
                           RRRM2_BRN_GC_ISS-T_OLD_GO13         0
                           RRRM2_BRN_FLT_ISS-T_YNG_FY8         0
                           RRRM2_BRN_FLT_ISS-T_YNG_FY7         0
                           RRRM2_BRN_FLT_ISS-T_OLD_FO19        0
                           RRRM2_BRN_FLT_ISS-T_OLD_FO14        0
                           RRRM2_BRN_FLT_ISS-T_YNG_FY2         0
                           RRRM2_BRN_FLT_ISS-T_OLD_FO17        0
                           RRRM2_BRN_GC_ISS-T_OLD_GO16         0
                           RRRM2_BRN_FLT_ISS-T_OLD_FO16        0
                           RRRM2_BRN_FLT_ISS-T_YNG_FY5         0
Ground Control | 29 Weeks  RRRM2_BRN_GC_ISS-T_OLD_GO16     18386
                           RRRM2_BRN_GC_ISS-T_OLD_GO19      7539
                           RRRM2_BRN_GC_ISS-T_OLD_GO18      5842
                           RRRM2_BRN_GC_ISS-T_OLD_GO13      3595
                           RRRM2_BRN_GC_ISS-T_YNG_GY4          0
                           RRRM2_BRN_GC_ISS-T_YNG_GY9          0
                           RRRM2_BRN_FLT_ISS-T_OLD_FO20        0
                           RRRM2_BRN_FLT_ISS-T_YNG_FY8         0
                           RRRM2_BRN_FLT_ISS-T_YNG_FY7         0
                           RRRM2_BRN_FLT_ISS-T_OLD_FO19        0
                           RRRM2_BRN_GC_ISS-T_YNG_GY7          0
                           RRRM2_BRN_FLT_ISS-T_OLD_FO14        0
                           RRRM2_BRN_GC_ISS-T_YNG_GY1          0
                           RRRM2_BRN_FLT_ISS-T_YNG_FY2         0
                           RRRM2_BRN_FLT_ISS-T_OLD_FO17        0
                           RRRM2_BRN_FLT_ISS-T_OLD_FO16        0
                           RRRM2_BRN_GC_ISS-T_YNG_GY2          0
                           RRRM2_BRN_FLT_ISS-T_YNG_FY5         0
Space Flight | 12 Weeks    RRRM2_BRN_FLT_ISS-T_YNG_FY8      5095
                           RRRM2_BRN_FLT_ISS-T_YNG_FY5      3914
                           RRRM2_BRN_FLT_ISS-T_YNG_FY2      3730
                           RRRM2_BRN_FLT_ISS-T_YNG_FY7      3669
                           RRRM2_BRN_GC_ISS-T_YNG_GY4          0
                           RRRM2_BRN_GC_ISS-T_YNG_GY9          0
                           RRRM2_BRN_GC_ISS-T_OLD_GO18         0
                           RRRM2_BRN_FLT_ISS-T_OLD_FO20        0
                           RRRM2_BRN_GC_ISS-T_OLD_GO19         0
                           RRRM2_BRN_GC_ISS-T_OLD_GO13         0
                           RRRM2_BRN_FLT_ISS-T_OLD_FO19        0
                           RRRM2_BRN_GC_ISS-T_YNG_GY7          0
                           RRRM2_BRN_FLT_ISS-T_OLD_FO14        0
                           RRRM2_BRN_GC_ISS-T_YNG_GY1          0
                           RRRM2_BRN_FLT_ISS-T_OLD_FO17        0
                           RRRM2_BRN_GC_ISS-T_OLD_GO16         0
                           RRRM2_BRN_FLT_ISS-T_OLD_FO16        0
                           RRRM2_BRN_GC_ISS-T_YNG_GY2          0
Space Flight | 29 Weeks    RRRM2_BRN_FLT_ISS-T_OLD_FO19     5747
                           RRRM2_BRN_FLT_ISS-T_OLD_FO20     4922
                           RRRM2_BRN_FLT_ISS-T_OLD_FO16     4050
                           RRRM2_BRN_FLT_ISS-T_OLD_FO14     3864
                           RRRM2_BRN_FLT_ISS-T_OLD_FO17     1321
                           RRRM2_BRN_GC_ISS-T_YNG_GY4          0
                           RRRM2_BRN_GC_ISS-T_YNG_GY9          0
                           RRRM2_BRN_GC_ISS-T_OLD_GO18         0
                           RRRM2_BRN_GC_ISS-T_OLD_GO19         0
                           RRRM2_BRN_GC_ISS-T_OLD_GO13         0
                           RRRM2_BRN_FLT_ISS-T_YNG_FY8         0
                           RRRM2_BRN_FLT_ISS-T_YNG_FY7         0
                           RRRM2_BRN_GC_ISS-T_YNG_GY7          0
                           RRRM2_BRN_GC_ISS-T_YNG_GY1          0
                           RRRM2_BRN_FLT_ISS-T_YNG_FY2         0
                           RRRM2_BRN_GC_ISS-T_OLD_GO16         0
                           RRRM2_BRN_GC_ISS-T_YNG_GY2          0
                           RRRM2_BRN_FLT_ISS-T_YNG_FY5         0
Name: count, dtype: int64 


Factor Value[Spaceflight] 

 Factor Value[Spaceflight]
Ground Control    66962
Space Flight      36312
Name: count, dtype: int64 


Factor Value[Spaceflight] 

 Group                      Factor Value[Spaceflight]
Ground Control | 12 Weeks  Ground Control               31600
                           Space Flight                     0
Ground Control | 29 Weeks  Ground Control               35362
                           Space Flight                     0
Space Flight | 12 Weeks    Space Flight                 16408
                           Ground Control                   0
Space Flight | 29 Weeks    Space Flight                 19904
                           Ground Control                   0
Name: count, dtype: int64 


Term Source REF.4 

 Term Source REF.4
OSD     66962
MESH    36312
Name: count, dtype: int64 


Term Source REF.4 

 Group                      Term Source REF.4
Ground Control | 12 Weeks  OSD                  31600
                           MESH                     0
Ground Control | 29 Weeks  OSD                  35362
                           MESH                     0
Space Flight | 12 Weeks    MESH                 16408
                           OSD                      0
Space Flight | 29 Weeks    MESH                 19904
                           OSD                      0
Name: count, dtype: int64 


Term Accession Number.4 

 Term Accession Number.4
https://osdr.nasa.gov/                               66962
http://purl.bioontology.org/ontology/MESH/D013026    36312
Name: count, dtype: int64 


Term Accession Number.4 

 Group                      Term Accession Number.4                          
Ground Control | 12 Weeks  https://osdr.nasa.gov/                               31600
                           http://purl.bioontology.org/ontology/MESH/D013026        0
Ground Control | 29 Weeks  https://osdr.nasa.gov/                               35362
                           http://purl.bioontology.org/ontology/MESH/D013026        0
Space Flight | 12 Weeks    http://purl.bioontology.org/ontology/MESH/D013026    16408
                           https://osdr.nasa.gov/                                   0
Space Flight | 29 Weeks    http://purl.bioontology.org/ontology/MESH/D013026    19904
                           https://osdr.nasa.gov/                                   0
Name: count, dtype: int64 


Factor Value[Age] 

 Factor Value[Age]
29    55266
12    48008
Name: count, dtype: int64 


Factor Value[Age] 

 Group                      Factor Value[Age]
Ground Control | 12 Weeks  12                   31600
                           29                       0
Ground Control | 29 Weeks  29                   35362
                           12                       0
Space Flight | 12 Weeks    12                   16408
                           29                       0
Space Flight | 29 Weeks    29                   19904
                           12                       0
Name: count, dtype: int64 


Characteristics[Age at Euthanasia] 

 Characteristics[Age at Euthanasia]
37    55266
20    48008
Name: count, dtype: int64 


Characteristics[Age at Euthanasia] 

 Group                      Characteristics[Age at Euthanasia]
Ground Control | 12 Weeks  20                                    31600
                           37                                        0
Ground Control | 29 Weeks  37                                    35362
                           20                                        0
Space Flight | 12 Weeks    20                                    16408
                           37                                        0
Space Flight | 29 Weeks    37                                    19904
                           20                                        0
Name: count, dtype: int64 


Parameter Value[Sample Preservation Method] 

 Parameter Value[Sample Preservation Method]
Liquid Nitrogen    66962
Cryochiller        36312
Name: count, dtype: int64 


Parameter Value[Sample Preservation Method] 

 Group                      Parameter Value[Sample Preservation Method]
Ground Control | 12 Weeks  Liquid Nitrogen                                31600
                           Cryochiller                                        0
Ground Control | 29 Weeks  Liquid Nitrogen                                35362
                           Cryochiller                                        0
Space Flight | 12 Weeks    Cryochiller                                    16408
                           Liquid Nitrogen                                    0
Space Flight | 29 Weeks    Cryochiller                                    19904
                           Liquid Nitrogen                                    0
Name: count, dtype: int64 


Term Source REF.9 

 Term Source REF.9
NCIT    66962
OSD     36312
Name: count, dtype: int64 


Term Source REF.9 

 Group                      Term Source REF.9
Ground Control | 12 Weeks  NCIT                 31600
                           OSD                      0
Ground Control | 29 Weeks  NCIT                 35362
                           OSD                      0
Space Flight | 12 Weeks    OSD                  16408
                           NCIT                     0
Space Flight | 29 Weeks    OSD                  19904
                           NCIT                     0
Name: count, dtype: int64 


Term Accession Number.9 

 Term Accession Number.9
http://purl.obolibrary.org/obo/NCIT_C68796    66962
https://osdr.nasa.gov/                        36312
Name: count, dtype: int64 


Term Accession Number.9 

 Group                      Term Accession Number.9                   
Ground Control | 12 Weeks  http://purl.obolibrary.org/obo/NCIT_C68796    31600
                           https://osdr.nasa.gov/                            0
Ground Control | 29 Weeks  http://purl.obolibrary.org/obo/NCIT_C68796    35362
                           https://osdr.nasa.gov/                            0
Space Flight | 12 Weeks    https://osdr.nasa.gov/                        16408
                           http://purl.obolibrary.org/obo/NCIT_C68796        0
Space Flight | 29 Weeks    https://osdr.nasa.gov/                        19904
                           http://purl.obolibrary.org/obo/NCIT_C68796        0
Name: count, dtype: int64 


Comment[RFID] 

 Comment[RFID]
6E35413D61    18386
6E371E2032     9651
6E2A671967     7547
6E3C342F47     7539
6E3C216122     5842
6E3D2C2D2C     5747
6E3C705065     5465
6E28536840     5265
6E3C42091B     5095
6E272D285A     4922
6E27313758     4050
6E3E102A12     3914
6E2A180C12     3864
6E394B6C23     3730
6E28307F36     3672
6E3E325E7C     3669
6E3A3C1239     3595
6E353B735A     1321
Name: count, dtype: int64 


Comment[RFID] 

 Group                      Comment[RFID]
Ground Control | 12 Weeks  6E371E2032        9651
                           6E2A671967        7547
                           6E3C705065        5465
                           6E28536840        5265
                           6E28307F36        3672
                           6E2A180C12           0
                           6E3A3C1239           0
                           6E3C342F47           0
                           6E3C42091B           0
                           6E3C216122           0
                           6E3D2C2D2C           0
                           6E3E102A12           0
                           6E3E325E7C           0
                           6E272D285A           0
                           6E353B735A           0
                           6E394B6C23           0
                           6E35413D61           0
                           6E27313758           0
Ground Control | 29 Weeks  6E35413D61       18386
                           6E3C342F47        7539
                           6E3C216122        5842
                           6E3A3C1239        3595
                           6E2A180C12           0
                           6E2A671967           0
                           6E3C42091B           0
                           6E3C705065           0
                           6E3D2C2D2C           0
                           6E3E102A12           0
                           6E3E325E7C           0
                           6E272D285A           0
                           6E353B735A           0
                           6E371E2032           0
                           6E394B6C23           0
                           6E28307F36           0
                           6E27313758           0
                           6E28536840           0
Space Flight | 12 Weeks    6E3C42091B        5095
                           6E3E102A12        3914
                           6E394B6C23        3730
                           6E3E325E7C        3669
                           6E2A180C12           0
                           6E2A671967           0
                           6E3A3C1239           0
                           6E3C342F47           0
                           6E3C216122           0
                           6E3C705065           0
                           6E3D2C2D2C           0
                           6E272D285A           0
                           6E353B735A           0
                           6E371E2032           0
                           6E28307F36           0
                           6E35413D61           0
                           6E27313758           0
                           6E28536840           0
Space Flight | 29 Weeks    6E3D2C2D2C        5747
                           6E272D285A        4922
                           6E27313758        4050
                           6E2A180C12        3864
                           6E353B735A        1321
                           6E2A671967           0
                           6E3A3C1239           0
                           6E3C342F47           0
                           6E3C42091B           0
                           6E3C216122           0
                           6E3C705065           0
                           6E3E102A12           0
                           6E3E325E7C           0
                           6E371E2032           0
                           6E394B6C23           0
                           6E28307F36           0
                           6E35413D61           0
                           6E28536840           0
Name: count, dtype: int64 


Comment[Euthanasia Date] 

 Comment[Euthanasia Date]
20-Sep-2019    31767
18-Sep-2019    29999
19-Sep-2019    25100
17-Sep-2019     8764
16-Sep-2019     7644
Name: count, dtype: int64 


Comment[Euthanasia Date] 

 Group                      Comment[Euthanasia Date]
Ground Control | 12 Weeks  18-Sep-2019                 26135
                           19-Sep-2019                  5465
                           16-Sep-2019                     0
                           17-Sep-2019                     0
                           20-Sep-2019                     0
Ground Control | 29 Weeks  20-Sep-2019                 31767
                           19-Sep-2019                  3595
                           16-Sep-2019                     0
                           17-Sep-2019                     0
                           18-Sep-2019                     0
Space Flight | 12 Weeks    17-Sep-2019                  8764
                           16-Sep-2019                  7644
                           18-Sep-2019                     0
                           19-Sep-2019                     0
                           20-Sep-2019                     0
Space Flight | 29 Weeks    19-Sep-2019                 16040
                           18-Sep-2019                  3864
                           16-Sep-2019                     0
                           17-Sep-2019                     0
                           20-Sep-2019                     0
Name: count, dtype: int64 


min_max_genes 

 min_max_genes
[201.0, None]                18386
[507.0, None]                 9651
[321.0, None]                 7547
[666.0, None]                 7539
[326.1, None]                 5842
[200, None]                   5747
[703.0, None]                 5465
[798.75, None]                5265
[481.425, None]               5095
[628.0, None]                 4922
[766.0, None]                 4050
[809.825, None]               3914
[719.475, None]               3864
[700.2, None]                 3730
[923.4000000000001, None]     3672
[331.925, None]               3669
[822.975, None]               3595
[316.3, None]                 1321
Name: count, dtype: int64 


min_max_genes 

 Group                      min_max_genes            
Ground Control | 12 Weeks  [507.0, None]                 9651
                           [321.0, None]                 7547
                           [703.0, None]                 5465
                           [798.75, None]                5265
                           [923.4000000000001, None]     3672
                           [200, None]                      0
                           [201.0, None]                    0
                           [316.3, None]                    0
                           [326.1, None]                    0
                           [331.925, None]                  0
                           [481.425, None]                  0
                           [628.0, None]                    0
                           [666.0, None]                    0
                           [700.2, None]                    0
                           [719.475, None]                  0
                           [766.0, None]                    0
                           [809.825, None]                  0
                           [822.975, None]                  0
Ground Control | 29 Weeks  [201.0, None]                18386
                           [666.0, None]                 7539
                           [326.1, None]                 5842
                           [822.975, None]               3595
                           [200, None]                      0
                           [316.3, None]                    0
                           [321.0, None]                    0
                           [331.925, None]                  0
                           [481.425, None]                  0
                           [507.0, None]                    0
                           [628.0, None]                    0
                           [700.2, None]                    0
                           [703.0, None]                    0
                           [719.475, None]                  0
                           [766.0, None]                    0
                           [798.75, None]                   0
                           [809.825, None]                  0
                           [923.4000000000001, None]        0
Space Flight | 12 Weeks    [481.425, None]               5095
                           [809.825, None]               3914
                           [700.2, None]                 3730
                           [331.925, None]               3669
                           [200, None]                      0
                           [201.0, None]                    0
                           [316.3, None]                    0
                           [321.0, None]                    0
                           [326.1, None]                    0
                           [507.0, None]                    0
                           [628.0, None]                    0
                           [666.0, None]                    0
                           [703.0, None]                    0
                           [719.475, None]                  0
                           [766.0, None]                    0
                           [798.75, None]                   0
                           [822.975, None]                  0
                           [923.4000000000001, None]        0
Space Flight | 29 Weeks    [200, None]                   5747
                           [628.0, None]                 4922
                           [766.0, None]                 4050
                           [719.475, None]               3864
                           [316.3, None]                 1321
                           [201.0, None]                    0
                           [321.0, None]                    0
                           [326.1, None]                    0
                           [331.925, None]                  0
                           [481.425, None]                  0
                           [507.0, None]                    0
                           [666.0, None]                    0
                           [700.2, None]                    0
                           [703.0, None]                    0
                           [798.75, None]                   0
                           [809.825, None]                  0
                           [822.975, None]                  0
                           [923.4000000000001, None]        0
Name: count, dtype: int64 


min_max_counts 

 min_max_counts
[300, 10018.199999999983]                  18386
[696.45, 23662.899999999972]                9651
[414.0, 11122.175000000005]                 7547
[942.0, 21190.0]                            7539
[422.1, 13468.399999999998]                 5842
[300, 14724.999999999998]                   5747
[1006.1500000000001, 23784.40000000001]     5465
[1176.375, 28050.25]                        5265
[681.7, 27907.149999999994]                 5095
[895.0, 19711.0]                            4922
[1213.2, 36130.25]                          4050
[1300.3, 32231.825000000015]                3914
[1128.9, 33910.62499999997]                 3864
[1087.2, 35338.0]                           3730
[1489.7, 37456.77499999999]                 3672
[452.77500000000003, 13453.3]               3669
[1282.925, 23156.550000000007]              3595
[376.3, 11766.900000000009]                 1321
Name: count, dtype: int64 


min_max_counts 

 Group                      min_max_counts                         
Ground Control | 12 Weeks  [696.45, 23662.899999999972]                9651
                           [414.0, 11122.175000000005]                 7547
                           [1006.1500000000001, 23784.40000000001]     5465
                           [1176.375, 28050.25]                        5265
                           [1489.7, 37456.77499999999]                 3672
                           [300, 10018.199999999983]                      0
                           [300, 14724.999999999998]                      0
                           [376.3, 11766.900000000009]                    0
                           [422.1, 13468.399999999998]                    0
                           [452.77500000000003, 13453.3]                  0
                           [681.7, 27907.149999999994]                    0
                           [895.0, 19711.0]                               0
                           [942.0, 21190.0]                               0
                           [1087.2, 35338.0]                              0
                           [1128.9, 33910.62499999997]                    0
                           [1213.2, 36130.25]                             0
                           [1282.925, 23156.550000000007]                 0
                           [1300.3, 32231.825000000015]                   0
Ground Control | 29 Weeks  [300, 10018.199999999983]                  18386
                           [942.0, 21190.0]                            7539
                           [422.1, 13468.399999999998]                 5842
                           [1282.925, 23156.550000000007]              3595
                           [300, 14724.999999999998]                      0
                           [376.3, 11766.900000000009]                    0
                           [414.0, 11122.175000000005]                    0
                           [452.77500000000003, 13453.3]                  0
                           [681.7, 27907.149999999994]                    0
                           [696.45, 23662.899999999972]                   0
                           [895.0, 19711.0]                               0
                           [1006.1500000000001, 23784.40000000001]        0
                           [1087.2, 35338.0]                              0
                           [1128.9, 33910.62499999997]                    0
                           [1176.375, 28050.25]                           0
                           [1213.2, 36130.25]                             0
                           [1300.3, 32231.825000000015]                   0
                           [1489.7, 37456.77499999999]                    0
Space Flight | 12 Weeks    [681.7, 27907.149999999994]                 5095
                           [1300.3, 32231.825000000015]                3914
                           [1087.2, 35338.0]                           3730
                           [452.77500000000003, 13453.3]               3669
                           [300, 10018.199999999983]                      0
                           [300, 14724.999999999998]                      0
                           [376.3, 11766.900000000009]                    0
                           [414.0, 11122.175000000005]                    0
                           [422.1, 13468.399999999998]                    0
                           [696.45, 23662.899999999972]                   0
                           [895.0, 19711.0]                               0
                           [942.0, 21190.0]                               0
                           [1006.1500000000001, 23784.40000000001]        0
                           [1128.9, 33910.62499999997]                    0
                           [1176.375, 28050.25]                           0
                           [1213.2, 36130.25]                             0
                           [1282.925, 23156.550000000007]                 0
                           [1489.7, 37456.77499999999]                    0
Space Flight | 29 Weeks    [300, 14724.999999999998]                   5747
                           [895.0, 19711.0]                            4922
                           [1213.2, 36130.25]                          4050
                           [1128.9, 33910.62499999997]                 3864
                           [376.3, 11766.900000000009]                 1321
                           [300, 10018.199999999983]                      0
                           [414.0, 11122.175000000005]                    0
                           [422.1, 13468.399999999998]                    0
                           [452.77500000000003, 13453.3]                  0
                           [681.7, 27907.149999999994]                    0
                           [696.45, 23662.899999999972]                   0
                           [942.0, 21190.0]                               0
                           [1006.1500000000001, 23784.40000000001]        0
                           [1087.2, 35338.0]                              0
                           [1176.375, 28050.25]                           0
                           [1282.925, 23156.550000000007]                 0
                           [1300.3, 32231.825000000015]                   0
                           [1489.7, 37456.77499999999]                    0
Name: count, dtype: int64 


Age_Start 

 Age_Start
29 Weeks    55266
12 Weeks    48008
Name: count, dtype: int64 


Age_Start 

 Group                      Age_Start
Ground Control | 12 Weeks  12 Weeks     31600
                           29 Weeks         0
Ground Control | 29 Weeks  29 Weeks     35362
                           12 Weeks         0
Space Flight | 12 Weeks    12 Weeks     16408
                           29 Weeks         0
Space Flight | 29 Weeks    29 Weeks     19904
                           12 Weeks         0
Name: count, dtype: int64 


Age_End 

 Age_End
37 Weeks    55266
20 Weeks    48008
Name: count, dtype: int64 


Age_End 

 Group                      Age_End 
Ground Control | 12 Weeks  20 Weeks    31600
                           37 Weeks        0
Ground Control | 29 Weeks  37 Weeks    35362
                           20 Weeks        0
Space Flight | 12 Weeks    20 Weeks    16408
                           37 Weeks        0
Space Flight | 29 Weeks    37 Weeks    19904
                           20 Weeks        0
Name: count, dtype: int64 


Condition 

 Condition
Ground Control    66962
Space Flight      36312
Name: count, dtype: int64 


Condition 

 Group                      Condition     
Ground Control | 12 Weeks  Ground Control    31600
                           Space Flight          0
Ground Control | 29 Weeks  Ground Control    35362
                           Space Flight          0
Space Flight | 12 Weeks    Space Flight      16408
                           Ground Control        0
Space Flight | 29 Weeks    Space Flight      19904
                           Ground Control        0
Name: count, dtype: int64 


Spaceflight 

 Spaceflight
0    66962
1    36312
Name: count, dtype: int64 


Spaceflight 

 Group                      Spaceflight
Ground Control | 12 Weeks  0              31600
                           1                  0
Ground Control | 29 Weeks  0              35362
                           1                  0
Space Flight | 12 Weeks    1              16408
                           0                  0
Space Flight | 29 Weeks    1              19904
                           0                  0
Name: count, dtype: int64 


           Aged  Parameter Value[Sample Storage Temperature]  Parameter Value[duration]  Senescence_Threshold  Senescence_Threshold_senmayo  Senescence_Threshold_senmayo_3    _scvi_batch  _scvi_labels  doublet_score  leiden_min_dist  leiden_n_neighbors  leiden_resolution  log1p_n_genes_by_counts  \
count  103274.0                                     103274.0                   103274.0         103274.000000                 103274.000000                   103274.000000  103274.000000      103274.0  103274.000000     1.032740e+05            103274.0       1.032740e+05            103274.000000   
mean        0.0                                        -80.0                       53.0              0.133743                      0.133743                        0.095622       8.808926           0.0       0.041344     1.300000e+00                40.0       2.700000e-02                 7.417736   
std         0.0                                          0.0                        0.0              0.042575                      0.042575                        0.034556       5.509775           0.0       0.044008     6.661370e-16                 0.0       2.081678e-17                 0.778077   
min         0.0                                        -80.0                       53.0              0.046570                      0.046570                        0.026312       0.000000           0.0       0.000939     1.300000e+00                40.0       2.700000e-02                 5.407172   
25%         0.0                                        -80.0                       53.0              0.106507                      0.106507                        0.076821       4.000000           0.0       0.012658     1.300000e+00                40.0       2.700000e-02                 6.786999   
50%         0.0                                        -80.0                       53.0              0.137236                      0.137236                        0.096417       9.000000           0.0       0.026517     1.300000e+00                40.0       2.700000e-02                 7.514800   
75%         0.0                                        -80.0                       53.0              0.137236                      0.137236                        0.096417      14.000000           0.0       0.051769     1.300000e+00                40.0       2.700000e-02                 8.114025   
max         0.0                                        -80.0                       53.0              0.243136                      0.243136                        0.186174      17.000000           0.0       0.427957     1.300000e+00                40.0       2.700000e-02                 8.866300   

       log1p_total_counts  log1p_total_counts_hb  log1p_total_counts_mt  log1p_total_counts_ribo  majority_voting_probabilities  min_dist_individual  n_cells_original_sample       n_counts        n_genes  n_genes_by_counts  pct_counts_hb  pct_counts_mt  pct_counts_ribo  resolution_individual  \
count       103274.000000          103274.000000          103274.000000            103274.000000                   8.023700e+04             103274.0            103274.000000  103274.000000  103274.000000      103274.000000  103274.000000  103274.000000    103274.000000           1.032740e+05   
mean             7.870787               0.258264               2.375908                 2.891556                   7.987201e-01                  1.5              8868.877617    6141.850098    2285.132850        2174.142524       0.014980       0.486775         0.829001           1.500000e-01   
std              0.360491               0.392817               0.573531                 0.849092                   3.266262e-01                  0.0              5555.444146    6050.134766    1536.856773        1450.048991       0.033168       0.374639         0.614566           5.551142e-17   
min              6.675428               0.000000               0.000000                 0.000000                   1.359645e-11                  1.5              1493.000000     300.000000     228.000000         222.000000       0.000000       0.000000         0.000000           1.500000e-01   
25%              7.608359               0.000000               2.026199                 2.401980                   7.635981e-01                  1.5              4863.000000    1469.000000     928.000000         885.250000       0.000000       0.217687         0.392694           1.500000e-01   
50%              7.967166               0.000000               2.409908                 2.958984                   9.806495e-01                  1.5              6503.000000    3866.000000    1918.000000        1834.000000       0.000000       0.390138         0.672651           1.500000e-01   
75%              8.189143               0.555061               2.776883                 3.533779                   9.984541e-01                  1.5             10779.000000    9198.000000    3499.000000        3340.000000       0.020060       0.641602         1.105970           1.500000e-01   
max              8.447374               2.846624               3.873097                 5.206285                   1.000000e+00                  1.5             20000.000000   37385.000000    7625.000000        7088.000000       0.965243       3.546953         8.065756           1.500000e-01   

       score_senmayo       senscore   total_counts  total_counts_hb  total_counts_mt  total_counts_ribo  
count  103274.000000  103274.000000  103274.000000    103274.000000    103274.000000      103274.000000  
mean       -0.021515      -0.021515    2778.911133         0.417356        11.512283          23.200752  
std         0.068418       0.068418     884.448792         0.730279         6.752755          17.517857  
min        -0.264210      -0.264210     791.686646         0.000000         0.000000           0.000000  
25%        -0.068912      -0.068912    2013.969574         0.000000         6.585198          10.045021  
50%        -0.026115      -0.026115    2883.670288         0.000000        10.132935          18.278371  
75%         0.019310       0.019310    3600.635742         0.742047        15.068856          33.253172  
max         0.465130       0.465130    4661.812988        16.229515        47.091106         181.415146  
                              Aged                                    Parameter Value[Sample Storage Temperature]                                          Parameter Value[duration]                                          Senescence_Threshold                                                   \
                             count mean  std  min  25%  50%  75%  max                                       count  mean  std   min   25%   50%   75%   max                     count  mean  std   min   25%   50%   75%   max                count      mean       std      min       25%       50%   
Group                                                                                                                                                                                                                                                                                                 
Ground Control | 12 Weeks  31600.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0                                     31600.0 -80.0  0.0 -80.0 -80.0 -80.0 -80.0 -80.0                   31600.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0              31600.0  0.133375  0.047414  0.04657  0.106507  0.106507   
Ground Control | 29 Weeks  35362.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0                                     35362.0 -80.0  0.0 -80.0 -80.0 -80.0 -80.0 -80.0                   35362.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0              35362.0  0.134809  0.036736  0.04657  0.106507  0.137236   
Space Flight | 12 Weeks    16408.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0                                     16408.0 -80.0  0.0 -80.0 -80.0 -80.0 -80.0 -80.0                   16408.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0              16408.0  0.132107  0.045722  0.04657  0.104362  0.106507   
Space Flight | 29 Weeks    19904.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0                                     19904.0 -80.0  0.0 -80.0 -80.0 -80.0 -80.0 -80.0                   19904.0  53.0  0.0  53.0  53.0  53.0  53.0  53.0              19904.0  0.133780  0.041360  0.04657  0.106507  0.137236   

                                              Senescence_Threshold_senmayo                                                                      Senescence_Threshold_senmayo_3                                                                       _scvi_batch             ... resolution_individual  \
                                75%       max                        count      mean       std      min       25%       50%       75%       max                          count      mean       std       min       25%       50%       75%       max       count       mean  ...                   75%   
Group                                                                                                                                                                                                                                                                        ...                         
Ground Control | 12 Weeks  0.137236  0.243136                      31600.0  0.133375  0.047414  0.04657  0.106507  0.106507  0.137236  0.243136                        31600.0  0.095616  0.038344  0.026312  0.076821  0.076821  0.096417  0.186174     31600.0   7.837278  ...                  0.15   
Ground Control | 29 Weeks  0.137236  0.243136                      35362.0  0.134809  0.036736  0.04657  0.106507  0.137236  0.137236  0.243136                        35362.0  0.096102  0.029704  0.026312  0.076821  0.096417  0.096417  0.186174     35362.0   8.970618  ...                  0.15   
Space Flight | 12 Weeks    0.137236  0.243136                      16408.0  0.132107  0.045722  0.04657  0.104362  0.106507  0.137236  0.243136                        16408.0  0.094648  0.037508  0.026312  0.070340  0.076821  0.096417  0.186174     16408.0  10.211543  ...                  0.15   
Space Flight | 29 Weeks    0.137236  0.243136                      19904.0  0.133780  0.041360  0.04657  0.106507  0.137236  0.137236  0.243136                        19904.0  0.095584  0.033665  0.026312  0.076821  0.096417  0.096417  0.186174     19904.0   8.908008  ...                  0.15   

                                score_senmayo                                                                       senscore                                                                       total_counts                                                                                            \
                            max         count      mean       std       min       25%       50%       75%       max    count      mean       std       min       25%       50%       75%       max        count         mean         std          min          25%          50%          75%          max   
Group                                                                                                                                                                                                                                                                                                       
Ground Control | 12 Weeks  0.15       31600.0 -0.033288  0.066989 -0.241807 -0.079504 -0.038444  0.006421  0.342407  31600.0 -0.033288  0.066989 -0.241807 -0.079504 -0.038444  0.006421  0.342407      31600.0  2919.924805  792.438599   998.631775  2217.641357  3095.519897  3620.714172  4505.247070   
Ground Control | 29 Weeks  0.15       35362.0 -0.015317  0.066006 -0.264210 -0.060767 -0.019144  0.024251  0.465130  35362.0 -0.015317  0.066006 -0.264210 -0.060767 -0.019144  0.024251  0.465130      35362.0  2443.630859  892.928528   791.686646  1679.858307  2301.552124  3228.400818  4571.165527   
Space Flight | 12 Weeks    0.15       16408.0 -0.020337  0.069283 -0.254214 -0.069104 -0.024681  0.021868  0.349868  16408.0 -0.020337  0.069283 -0.254214 -0.069104 -0.024681  0.021868  0.349868      16408.0  3050.029053  877.161987  1028.917236  2264.757202  3291.687866  3819.286377  4661.812988   
Space Flight | 29 Weeks    0.15       19904.0 -0.014805  0.071641 -0.228862 -0.064321 -0.020246  0.027663  0.343610  19904.0 -0.014805  0.071641 -0.228862 -0.064321 -0.020246  0.027663  0.343610      19904.0  2927.207275  835.011536   834.153625  2128.512390  3238.700073  3646.416016  4650.085938   

                          total_counts_hb                                                         total_counts_mt                                                                            total_counts_ribo                                                                          
                                    count      mean       std  min  25%  50%       75%        max           count       mean       std       min        25%        50%        75%        max             count       mean        std  min        25%        50%        75%         max  
Group                                                                                                                                                                                                                                                                                   
Ground Control | 12 Weeks         31600.0  0.419395  0.695018  0.0  0.0  0.0  0.763981  15.948441         31600.0   8.673212  5.263829  0.000000   4.875312   7.473253  11.234807  37.437180           31600.0  15.850301   9.099817  0.0   9.972312  14.025234  19.659446  117.593636  
Ground Control | 29 Weeks         35362.0  0.343186  0.723648  0.0  0.0  0.0  0.000000  13.867619         35362.0   9.907805  5.310478  0.000000   6.143592   9.282199  12.854851  38.024384           35362.0  15.092834  13.335827  0.0   5.742307  10.452679  21.477554  147.756897  
Space Flight | 12 Weeks           16408.0  0.485886  0.739634  0.0  0.0  0.0  0.837134  14.059389         16408.0  14.301973  6.259934  1.286561   9.453764  13.222489  18.227602  41.484730           16408.0  36.673164  17.590736  0.0  24.099486  34.727049  46.690003  181.415146  
Space Flight | 29 Weeks           19904.0  0.489396  0.774680  0.0  0.0  0.0  0.841994  16.229515         19904.0  16.570513  7.799766  0.000000  10.343445  15.495999  21.877836  47.091106           19904.0  38.169167  17.706547  0.0  25.051446  35.702381  48.261718  160.861664  

[4 rows x 264 columns]


*** Cell Composition (%) ***

annotation_by_overlap         Excitatory  Inhibitory  Microglial  Oligodendrocyte  Astrocyte   OPC  Excitatory-Inhibitory
sample                                                                                                                   
RRRM2_BRN_GC_ISS-T_YNG_GY4         33.76       30.25        3.95            16.18      11.46  2.52                   1.88
RRRM2_BRN_GC_ISS-T_YNG_GY9         26.42       37.53        4.21            16.60      10.01  3.60                   1.63
RRRM2_BRN_GC_ISS-T_OLD_GO18        32.16       37.08        4.74            13.69       9.28  3.05                   0.00
RRRM2_BRN_FLT_ISS-T_OLD_FO20       31.82       25.68        4.37            25.25       8.19  3.51                   1.18
RRRM2_BRN_GC_ISS-T_OLD_GO19        26.29       40.30        4.39            18.09       7.52  3.38                   0.03
RRRM2_BRN_GC_ISS-T_OLD_GO13        19.81       30.43        3.50            27.48      11.52  3.70                   3.56
RRRM2_BRN_FLT_ISS-T_YNG_FY8        15.45       39.16        5.71            23.49       8.85  4.30                   3.04
RRRM2_BRN_FLT_ISS-T_YNG_FY7        27.12       22.76        5.21            28.56       7.25  3.46                   5.64
RRRM2_BRN_FLT_ISS-T_OLD_FO19       43.83       31.15        2.78            13.26       6.51  2.47                   0.00
RRRM2_BRN_GC_ISS-T_YNG_GY7         21.42       33.11        4.35            22.92      11.05  3.97                   3.17
RRRM2_BRN_FLT_ISS-T_OLD_FO14       39.39       17.65        4.09            23.27       8.83  3.83                   2.95
RRRM2_BRN_GC_ISS-T_YNG_GY1         34.20       24.26        4.19            20.89       9.40  3.57                   3.49
RRRM2_BRN_FLT_ISS-T_YNG_FY2        37.48       18.23        4.80            24.08       8.28  4.08                   3.06
RRRM2_BRN_FLT_ISS-T_OLD_FO17       65.93       16.28        2.27            10.22       3.26  1.59                   0.45
RRRM2_BRN_GC_ISS-T_OLD_GO16        77.91        8.15        1.31             6.75       3.56  1.18                   1.14
RRRM2_BRN_FLT_ISS-T_OLD_FO16       41.06       21.38        4.40            19.01       7.90  3.21                   3.04
RRRM2_BRN_GC_ISS-T_YNG_GY2         30.40       23.36        3.88            24.38       8.90  3.67                   5.42
RRRM2_BRN_FLT_ISS-T_YNG_FY5        44.07       21.41        4.65            17.50       7.26  3.70                   1.41


                               Original Cell N  N Cells  Percent_Filtered
sample                                                                  
RRRM2_BRN_GC_ISS-T_OLD_GO13              3880     3595              7.35
RRRM2_BRN_GC_ISS-T_YNG_GY1               3968     3672              7.46
RRRM2_BRN_GC_ISS-T_OLD_GO16             20000    18386              8.07
RRRM2_BRN_GC_ISS-T_YNG_GY7               5776     5265              8.85
RRRM2_BRN_FLT_ISS-T_OLD_FO14             4260     3864              9.30
RRRM2_BRN_GC_ISS-T_YNG_GY9               6044     5465              9.58
RRRM2_BRN_FLT_ISS-T_YNG_FY2              4125     3730              9.58
RRRM2_BRN_FLT_ISS-T_YNG_FY8              5658     5095              9.95
RRRM2_BRN_GC_ISS-T_OLD_GO18              6503     5842             10.16
RRRM2_BRN_GC_ISS-T_YNG_GY2              10779     9651             10.46
RRRM2_BRN_GC_ISS-T_OLD_GO19              8476     7539             11.05
RRRM2_BRN_FLT_ISS-T_OLD_FO17             1493     1321             11.52
RRRM2_BRN_GC_ISS-T_YNG_GY4               8542     7547             11.65
RRRM2_BRN_FLT_ISS-T_OLD_FO20             5641     4922             12.75
RRRM2_BRN_FLT_ISS-T_YNG_FY7              4238     3669             13.43
RRRM2_BRN_FLT_ISS-T_OLD_FO16             4863     4050             16.72
RRRM2_BRN_FLT_ISS-T_YNG_FY5              4714     3914             16.97
RRRM2_BRN_FLT_ISS-T_OLD_FO19             7265     5747             20.89

Get Marker Gene Sets¶

From Google Drive, except senmayo derived from file downloaded from https://www.gsea-msigdb.org/gsea/msigdb/human/geneset/SAUL_SEN_MAYO.html then created using:

from pybiomart import Server

senmayo = pd.read_csv("resources/SAUL_SEN_MAYO.v2025.1.Hs.tsv",
                      sep="\t", header=0)
senmayo = senmayo[senmayo.STANDARD_NAME == "GENE_SYMBOLS"]
senmayo = pd.Series({"Senmayo": senmayo.iloc[0, 1].split(
    ",")}, name="symbol").rename_axis("Gene_Set").explode().str.strip(
        ).replace("", np.nan).dropna().to_frame()
server = Server(host="http://www.ensembl.org")
mart = server.marts["ENSEMBL_MART_ENSEMBL"] # Access the Ensembl mart
human_dataset = mart.datasets["hsapiens_gene_ensembl"]
orthologs = human_dataset.query(attributes=[
    "external_gene_name", "mmusculus_homolog_associated_gene_name"])
orthologs = orthologs.dropna().set_index(orthologs.columns[0])
orthologs = orthologs.loc[orthologs.index.intersection(
    senmayo.symbol.to_list())].iloc[:, 0]
print(f"{orthologs.shape[0]} orthologs found out of"
      f" {len(senmayo.symbol.unique())} senmayo genes")
senmayo = senmayo.assign(symbol=senmayo.replace({"symbol": dict(zip(
    orthologs.index, orthologs.values))}))
senmayo.to_csv("gene_sets/senmayo.csv")

(Also could use scflow.tl.convert_gene_species(senmayo.symbol.to_list()))

Certain gene sets created from Google Drive ADBR AWG > Projects > White Matter > Gene Sets files (with the suffix = "_adjusted") were modified for consistency, e.g.,

pd.read_csv("gene_sets/_iron_genes_gmt_out.csv", index_col=[
    0, 1]).rename_axis(["row_id", "pathway"]).stack().to_frame(
        "symbol").reset_index(-1, drop=True).reset_index().to_csv(
            "gene_sets/_iron_genes_gmt_out_adjusted.csv")

A Priori¶

In [3]:
mks = [pd.read_csv(os.path.join("gene_sets", i)).dropna(
    how="all", axis=1).assign(Source_File=i) for i in os.listdir("gene_sets")]
mks = [x.assign(Gene_Set=x["Source_File"].iloc[0].split("_2025")[0]) if (
    "pathway" in x) else x for x in mks]
mks = pd.concat(mks).drop("Unnamed: 0", axis=1).drop("row_id", axis=1)
mks = mks[mks.symbol.isin(self.rna.var_names)]
mks = mks[["Gene_Set", "symbol"]].set_index("Gene_Set").groupby(
    "Gene_Set").apply(lambda x: x["symbol"].to_list())
marker_genes_dict = dict(mks)
marker_gene_sets = mks.copy()
print(marker_gene_sets)
Gene_Set
GOBP_CELLULAR_RESPONSE_TO_IRON_ION                                                                                                                                                                                                                          [B2m, Bmp6, Gpld1, Ireb2, Tfrc, Trf]
GOBP_CENTRAL_NERVOUS_SYSTEM_MYELIN_FORMATION                                                                                                                                                                                                      [Abca2, Ckap5, Cntn1, Ercc2, Mag, Mios, Tenm4]
GOBP_INTRACELLULAR_IRON_ION_HOMEOSTASIS                                                                                                                                                      [Abcb7, Aco1, Atp13a2, Atp6ap1, Atp6v0a2, Atp6v0d1, Atp6v1a, Atp6v1g1, B2m, Bmp6, Bmyc, Bola2, C...
GOBP_IRON_COORDINATION_ENTITY_TRANSPORT                                                                                                                                                                                                        [Abcb7, Abcc5, Flvcr1, Pgrmc2, Slc22a17, Slc48a1]
GOBP_IRON_ION_IMPORT_ACROSS_PLASMA_MEMBRANE                                                                                                                                                                                                                                       [Iscu, Steap2]
GOBP_IRON_ION_TRANSMEMBRANE_TRANSPORT                                                                                                                                                           [Abcb7, Abcc5, Atp7a, Hif1a, Iscu, Nos1, Slc11a2, Slc25a28, Slc25a37, Slc39a14, Slc48a1, Steap2]
GOBP_IRON_ION_TRANSPORT                                                                                                                                                                      [Abcb7, Abcc5, Arhgap1, Atp7a, B2m, Cltc, Dnm2, Flvcr1, Fth1, Heph, Hif1a, Iscu, Lmtk2, Mmgt1, M...
GOBP_MULTICELLULAR_ORGANISMAL_LEVEL_IRON_ION_HOMEOSTASIS                                                                                                                                          [Ank1, B2m, Bmp6, Btbd9, Eif2ak1, Epas1, Fbxl5, Fech, Htt, Ireb2, Neo1, Picalm, Slc11a2, Sod2]
GOBP_MYELIN_ASSEMBLY                                                                                                                                                                         [Abca2, Cd9, Ckap5, Cntn1, Cntnap1, Dicer1, Epb41l3, Ercc2, Fig4, Gnpat, Gpc1, Ilk, Mag, Mios, M...
GOBP_MYELIN_MAINTENANCE                                                                                                                                                                      [Abcd1, Abcd2, Akt1, Akt2, Clu, Degs1, Epb41l3, Fa2h, Myrf, Ndrg1, Pals1, Plec, Pten, Sh3tc2, Sod1]
GOBP_NEGATIVE_REGULATION_OF_IRON_ION_TRANSMEMBRANE_TRANSPORT                                                                                                                                                                                                                 [Atp7a, Iscu, Nos1]
GOBP_NEGATIVE_REGULATION_OF_IRON_ION_TRANSPORT                                                                                                                                                                                                                               [Atp7a, Iscu, Nos1]
GOBP_REGULATION_OF_IRON_ION_TRANSMEMBRANE_TRANSPORT                                                                                                                                                                                                                          [Atp7a, Iscu, Nos1]
GOBP_REGULATION_OF_IRON_ION_TRANSPORT                                                                                                                                                                                                                              [Atp7a, B2m, Iscu, Nos1, Trf]
GOBP_REGULATION_OF_MYELINATION                                                                                                                                                               [Akt1, Cdh2, Ctnnb1, Cyfip1, Dag1, Dicer1, Dlg1, Eif2ak3, Fig4, Hes5, Hgf, Hnrnpk, Igf1, Jam2, L...
GOBP_RESPONSE_TO_IRON_ION                                                                                                                                                                                                           [Abat, Aco1, B2m, Bcl2, Bmp6, Gpld1, Ireb2, Snca, Tfrc, Trf]
GOBP_SEQUESTERING_OF_IRON_ION                                                                                                                                                                                                                                                       [Fth1, Ftl1]
GOBP_SPHINGOMYELIN_BIOSYNTHETIC_PROCESS                                                                                                                                                                                       [Abca8a, Abca8b, Ormdl3, Osbp, Samd8, Sgms1, Sptlc1, Sptlc2, Vapa]
GOBP_SPHINGOMYELIN_CATABOLIC_PROCESS                                                                                                                                                                                                              [Prkcd, Smpd1, Smpd3, Smpd4, Smpdl3a, Smpdl3b]
GOBP_SPHINGOMYELIN_METABOLIC_PROCESS                                                                                                                                                         [Abca2, Abca8a, Abca8b, Ormdl3, Osbp, Prkcd, Samd8, Sgms1, Smpd1, Smpd3, Smpd4, Smpdl3a, Smpdl3b...
GOMF_FERRIC_IRON_BINDING                                                                                                                                                                                                                                                       [Fth1, Ftl1, Trf]
GOMF_FERROUS_IRON_BINDING                                                                                                                                                                    [Alkbh1, Alkbh3, Cdo1, Dnajc24, Egln1, Egln2, Fth1, Ftl1, Fto, Heph, Hif1an, Iscu, Nt5e, Phyh, P...
GOMF_FERROUS_IRON_TRANSMEMBRANE_TRANSPORTER_ACTIVITY                                                                                                                                                                                              [Mmgt1, Slc11a2, Slc25a28, Slc25a37, Slc39a14]
GOMF_IRON_ION_BINDING                                                                                                                                                                        [Abce1, Aco2, Ado, Agmo, Alkbh1, Alkbh3, Alkbh8, Calr, Cdo1, Ciapin1, Cisd1, Cygb, Cyp11a1, Cyp2...
GOMF_IRON_ION_TRANSMEMBRANE_TRANSPORTER_ACTIVITY                                                                                                                                                                                            [Mmgt1, Slc11a2, Slc25a28, Slc25a37, Slc39a14, Tfrc]
GOMF_OXIDOREDUCTASE_ACTIVITY_ACTING_ON_PAIRED_DONORS_WITH_INCORPORATION_OR_REDUCTION_OF_MOLECULAR_OXYGEN_REDUCED_IRON_SULFUR_PROTEIN_AS_ONE_DONOR_AND_INCORPORATION_OF_ONE_ATOM_OF_OXYGEN                                                                           [Ahr, Cyp11a1, Cyp2u1, Fdx1]
GOMF_SPHINGOMYELIN_PHOSPHODIESTERASE_ACTIVITY                                                                                                                                                                                                            [Smpd1, Smpd3, Smpd4, Smpdl3a, Smpdl3b]
GOMF_STRUCTURAL_CONSTITUENT_OF_MYELIN_SHEATH                                                                                                                                                                                                           [Gpm6b, Mal, Mal2, Mbp, Mobp, Pllp, Plp1]
REACTOME_IRON_UPTAKE_AND_TRANSPORT                                                                                                                                                           [Aco1, Atp6ap1, Atp6v0a1, Atp6v0a2, Atp6v0a4, Atp6v0b, Atp6v0c, Atp6v0d1, Atp6v0e, Atp6v0e2, Atp...
REACTOME_MITOCHONDRIAL_IRON_SULFUR_CLUSTER_BIOGENESIS                                                                                                                                                                                 [Fdx1, Fdxr, Glrx5, Hscb, Isca1, Isca2, Iscu, Lyrm4, Nfs1]
Senmayo                                                                                                                                                                                      [Acvr1b, Angpt1, Bex3, Bmp6, Cd9, Csf1, Ctnnb1, Ctsb, Egf, Egfr, Ets2, Fgf1, Hgf, Hmgb1, Igf1, I...
WP_IRON_HOMEOSTASIS                                                                                                                                                                                                                                                     [Fth1, Ftl1, Ireb2, Trf]
dtype: object

Clusters in Data¶

In [4]:
self.find_markers(col_celltype=col_celltype)
df_celltype_markers = self.get_markers_df(
    n_genes=50, col_celltype=col_celltype,
    log2fc_threshold=1, p_threshold=1e-10)
df_celltype_markers.groupby(col_celltype).apply(lambda x: x.head(3))
No description has been provided for this image
Out[4]:
scores logfoldchanges pvals pvals_adj
annotation_by_overlap annotation_by_overlap names
Astrocyte Astrocyte Nim1k 47.064068 2.660807 0.0 0.0
Pbxip1 45.993198 4.411093 0.0 0.0
Aldh1l1 46.067970 4.603257 0.0 0.0
Excitatory Excitatory Slc8a2 59.332294 1.443789 0.0 0.0
Gm37407 57.852417 1.410103 0.0 0.0
Kcnh3 57.889107 1.536317 0.0 0.0
Excitatory-Inhibitory Excitatory-Inhibitory Megf9 52.264030 1.840525 0.0 0.0
Rasgrf1 51.559391 1.407420 0.0 0.0
Scn8a 51.671570 1.217524 0.0 0.0
Inhibitory Inhibitory Zmym3 51.089523 1.472235 0.0 0.0
Hrh3 51.470680 1.819407 0.0 0.0
N4bp2l1 51.454659 1.068241 0.0 0.0
Microglial Microglial Srgap2 125.218414 4.258848 0.0 0.0
Tgfbr1 124.597107 7.077548 0.0 0.0
Slco2b1 64.663284 8.772433 0.0 0.0
OPC OPC Brinp3 140.637009 3.586013 0.0 0.0
Grid2 134.924301 2.397604 0.0 0.0
Epn2 126.522072 3.946976 0.0 0.0
Oligodendrocyte Oligodendrocyte Hcn2 55.754898 2.162222 0.0 0.0
Ankib1 53.085659 1.270694 0.0 0.0
Tmem229a 52.977585 3.292466 0.0 0.0

Score Senescence¶

See Available Hubs¶

In [5]:
hubs = senepy.load_hubs(species=species)
hubs.metadata.set_index(["tissue", "cell"]).sort_index()
Out[5]:
hub_num size n_sen hyp
tissue cell
Bladder bladder cell 0 36 0 1.000000e+00
bladder cell 1 20 0 1.000000e+00
bladder cell 2 67 3 2.352239e-02
endothelial cell 3 5 1 4.491007e-02
Brain microglial cell 1 59 1 4.189625e-01
microglial cell 2 22 2 1.704626e-02
Diaphragm mesenchymal stem cell 0 247 6 2.634383e-02
skeletal muscle satellite cell 0 60 0 1.000000e+00
skeletal muscle satellite cell 1 375 14 9.664211e-06
Fat endothelial cell 0 416 12 4.660581e-04
mesenchymal stem cell 0 38 0 1.000000e+00
mesenchymal stem cell 1 29 0 1.000000e+00
mesenchymal stem cell 2 44 2 6.129178e-02
HSC hematopoietic stem cell 1 56 1 4.026751e-01
hematopoietic stem cell 2 172 1 7.955235e-01
hematopoietic stem cell 3 77 0 1.000000e+00
Heart_and_Aorta endocardial cell 0 171 17 3.456117e-13
endocardial cell 1 180 3 2.278544e-01
endothelial cell 0 4 1 3.609150e-02
endothelial cell 1 41 3 6.217995e-03
fibroblast 0 80 5 8.372629e-04
fibroblast 1 50 2 7.663093e-02
myocyte 0 325 4 3.465634e-01
myocyte 1 95 10 1.655335e-08
smooth muscle cell 0 120 5 4.954367e-03
Kidney Henle thick ascending limb epithelial cell 0 765 20 2.476907e-05
collecting duct principal cell 0 1323 20 1.865129e-02
distal convoluted tubule epithelial cell 0 330 2 8.074111e-01
epithelial cell of proximal tubule 1 53 3 1.261710e-02
fenestrated cell 0 131 4 3.239778e-02
macrophage 0 365 12 1.418130e-04
podocyte 0 315 9 2.531397e-03
proximal convoluted tubule epithelial cell 0 34 0 1.000000e+00
proximal convoluted tubule epithelial cell 1 31 3 2.803020e-03
Large_Intestine epithelial cell 0 942 7 7.637002e-01
goblet cell 1 36 0 1.000000e+00
secretory cell 0 34 0 1.000000e+00
Limb_Muscle macrophage 0 184 2 5.034232e-01
macrophage 1 45 1 3.389737e-01
skeletal muscle satellite cell 0 27 0 1.000000e+00
Liver Kupffer cell 0 638 14 2.268194e-03
Kupffer cell 1 3305 17 9.983103e-01
endothelial cell of hepatic sinusoid 0 205 12 4.280991e-07
hepatocyte 0 1600 14 6.086587e-01
hepatocyte 1 143 7 3.511115e-04
Lung alveolar macrophage 1 37 0 1.000000e+00
fibroblast 0 244 2 6.562770e-01
fibroblast 1 552 21 3.756258e-08
Lymphoid B cell 0 27 0 1.000000e+00
B cell 1 167 4 6.748011e-02
NK cell 1 31 0 1.000000e+00
NK cell 2 64 3 2.086629e-02
T cell 0 54 0 1.000000e+00
T cell 1 159 7 6.629509e-04
T cell 2 35 2 4.064697e-02
Myeloid macrophage 0 77 0 1.000000e+00
macrophage 1 57 1 4.081541e-01
monocyte 0 67 0 1.000000e+00
monocyte 1 14 2 7.044369e-03
Pancreas pancreatic A cell 0 135 4 3.559225e-02
Thymus thymocyte 0 680 13 9.917213e-03
thymocyte 1 411 8 3.573660e-02
Tongue basal cell 0 50 1 3.687258e-01
basal cell 1 266 13 1.091835e-06
keratinocyte 0 197 5 3.504157e-02
keratinocyte 1 350 16 1.499907e-07
Trachea basal cell 0 45 0 1.000000e+00
basal cell 2 289 14 4.628384e-07
fibroblast 0 808 27 5.751673e-09
fibroblast 1 102 2 2.394198e-01
macrophage 0 228 1 8.784059e-01
macrophage 1 1105 20 2.802038e-03

Run Scoring¶

If you want just to find the senescence-related genes, run:

tissue = "Brain"  # or whatever you want here
celltype = None  # or whatever you want here
genes_senepy, hubs, figs = find_senescence_genes(
    self.rna, species=species, tissue=tissue, celltype=celltype,
    overlap_threshold=0, literature_sources=None,
    sengpt_sources=True, plot=True, col_celltype=col_celltype
)  # find tissue- and/or cell type-specific genes

Senepy¶

In [6]:
%%time

# tissue = ["Brain", "Myeloid"]
tissue = "Brain"
# tissue = None

# celltype = ["microglia", "t cell", "monocyte", "GABA interneuron"]
# celltype = "microglia"
# celltype = "microglial cell"
celltype = None

if "senepy" in sen_metrics:
    self.rna.X = self.rna.layers["log1p"].copy()
    self.rna, genes_senepy, figs = run_senepy(
        self.rna, species=species, tissue=tissue, celltype=celltype,
        overlap_threshold=0, literature_sources=None,
        sengpt_sources=True, col_celltype=col_celltype,
        col_senscore="score_senepy", identifiers=[col_celltype],
        use_translator=True, plot=True, figsize=(20, 20),
        swap_axes=False, standard_scale="group", plot_layer="log1p"
    )  # find tissue- and/or cell type-specific genes
    self.rna.obs.loc[
        :, "score_senepy_original_scale"] = self.rna.obs.score_senepy
    self.rna.obs.loc[:, "score_senepy"] = np.log(
        self.rna.obs.score_senepy)  # log-transform senescence score
    self.rna.obs[["score_senepy"]]
CPU times: user 3 μs, sys: 0 ns, total: 3 μs
Wall time: 4.77 μs

Senmayo¶

In [7]:
sc.tl.score_genes(self.rna, marker_gene_sets.loc["Senmayo"],
                  ctrl_as_ref=True, ctrl_size=50, gene_pool=None,
                  n_bins=25, score_name="score_senmayo", random_state=0,
                  copy=False, use_raw=None, layer="log1p")
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/scanpy/tools/_score_genes.py:241: DeprecationWarning: Bitwise inversion '~' on bool is deprecated and will be removed in Python 3.16. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  r_genes: pd.Index[str] = obs_cut[(obs_cut == cut) & ~keep_ctrl_in_obs_cut].index

Label SnCs¶

Define Snc Threshold & Label Cells¶

Based on percentile threshold derived from control group

In [8]:
# Determine Threshold
perc_s, perc = str(100 - percentile) + "%", 1 - (percentile / 100)
p_h = 3
perc_s_h, perc_h = str(100 - p_h) + "%", 1 - (p_h / 100)
print("Percentile for Threshold:", perc_s)
for u in sen_metrics:
    self.rna.obs = self.rna.obs.join(self.rna.obs[self.rna.obs[
        col_batch] == keys[col_batch]["key_control"]].groupby(
            col_celltype).apply(lambda x: x[f"score_{u}"].describe(
                percentiles=[perc])[perc_s], include_groups=False).to_frame(
                    f"Senescence_Threshold_{u}"), on=col_celltype).loc[
                        self.rna.obs.index]
    self.rna.obs = self.rna.obs.join(self.rna.obs[self.rna.obs[
        col_batch] == keys[col_batch]["key_control"]].groupby(
            col_celltype).apply(lambda x: x[f"score_{u}"].describe(
                percentiles=[perc_h])[perc_s_h],
                                include_groups=False).to_frame(
                                    f"Senescence_Threshold_{u}_{p_h}"),
                                on=col_celltype).loc[self.rna.obs.index]

# Binary CLassification
for x in sen_metrics:
    self.rna.obs.loc[:, f"Senescent_Cell_{x}"] = (self.rna.obs[
        f"score_{x}"] >= self.rna.obs[f"Senescence_Threshold_{x}"])
    self.rna.obs.loc[:, f"Senescent_Cell_{x}_{p_h}"] = (self.rna.obs[
        f"score_{x}"] >= self.rna.obs[f"Senescence_Threshold_{x}_{p_h}"])

# String Labels (for Plotting/Categorical Analysis)
for x in sen_metrics:
    self.rna.obs.loc[:, f"Senescent_Cell_Label_{x}"] = self.rna.obs[
        f"Senescent_Cell_{x}"].astype(bool).astype(str).replace({
            "True": "Senescent", "False": "Non-Senescent"})
    self.rna.obs.loc[:, f"Senescent_Cell_Label_hierarchy_{x}"] = self.rna.obs[
        f"Senescent_Cell_{x}"].astype(bool).astype(str).replace({
            "True": "Senescent", "False": "Non-Senescent"})
    self.rna.obs.loc[:, f"Senescent_Cell_Label_{x}_{p_h}"] = self.rna.obs[
        f"Senescent_Cell_{x}_{p_h}"].astype(bool).astype(str).replace({
            "True": "Senescent", "False": "Non-Senescent"})
    self.rna.obs.loc[:, f"Senescent_Cell_Label_by_Type_{x}"] = self.rna.obs[
        f"Senescent_Cell_Label_{x}"].replace({
            "Senescent": "SnC ", "Non-Senescent": ""}) + self.rna.obs[
                col_celltype].astype(str)
    self.rna.obs.loc[:, f"SnC_hierarchy_{x}"] = self.rna.obs[
        f"Senescent_Cell_Label_{x}"].replace({
            "Senescent": "SnC ", "Non-Senescent": ""}) + self.rna.obs[
                col_celltype + "_hierarchy"].astype(str)

# Descriptives
for x in sen_metrics:
    print(x, round(self.rna.obs[[
        f"Senescent_Cell_Label_{x}", col_celltype]].value_counts(
            normalize=True).sort_index() * 100, 1).unstack(0))


# Choose Metrics for Main Analysis
for x in ["Senescent_Cell_Label", "Senescent_Cell", "SnC_hierarchy",
            "Senescence_Threshold", "Senescent_Cell_Label_by_Type"]:
    self.rna.obs.loc[:, x] = self.rna.obs[f"{x}_{use_metric}"]
self.rna.obs.loc[:, "senscore"] = self.rna.obs[f"score_{use_metric}"]
genes = marker_gene_sets.loc["Senmayo"] if (
    use_metric == "senmayo") else genes_senepy
Percentile for Threshold: 99%
senmayo Senescent_Cell_Label_senmayo  Non-Senescent  Senescent
annotation_by_overlap                                 
Excitatory                             39.3        0.6
Inhibitory                             24.9        0.4
Microglial                              3.7        0.1
Oligodendrocyte                        17.6        0.3
Astrocyte                               7.8        0.1
OPC                                     2.9        0.1
Excitatory-Inhibitory                   2.1        0.0

Label Batch/Cell-Specific Senescence Percentiles¶

In [9]:
# for x in ["Senescence_Label", "Senescence_CellType"]:
#     if x in self.rna.obs:
#         self.rna.obs = self.rna.obs.drop(x, axis=1)

# # %ile Thresholds (Overall)
# thresh = self.rna.obs["score_senepy"].describe(
#     percentiles=[0.90, 0.95, 0.99])
# thres_ct =  self.rna.obs[["score_senepy", col_celltype]].groupby(
#     col_celltype).describe(percentiles=[0.90, 0.95, 0.99])["score_senepy"]

# sen = self.rna.obs["score_senepy"].apply(
#     lambda x: "Top 1%" if x >= float(thresh.loc["99%"]) else "Top 5%" if (
#         x >= float(thresh.loc["95%"])) else "Top 10%" if x >= float(
#             thresh.loc["90%"]) else "Bottom 90%").to_frame(
#                 "Senescence_Label").loc[self.rna.obs.index]
# self.rna.obs = self.rna.obs.join(sen).loc[self.rna.obs.index]

# # %ile Thresholds (by Cell Type)
# sct = self.rna.obs.groupby(
#     col_celltype).apply(lambda g: g["score_senepy"].apply(
#         lambda x: f"Top 1% {g.name}" if x >= float(thres_ct.loc[g.name][
#             "99%"]) else f"Top 5% {g.name}" if (x >= float(thres_ct.loc[
#                 g.name]["95%"])) else f"Top 10% {g.name}" if x >= float(
#                     thres_ct.loc[g.name]["90%"]) else g.name),
#                         include_groups=False)

# sct = sct.to_frame("Senescence_CellType").reset_index(0, drop=True)
# sct = sct.loc[self.rna.obs.index]
# self.rna.obs = self.rna.obs.join(sct).loc[self.rna.obs.index]

# for x in ["Senescence_Label", "Senescence_CellType"]:
#     self.rna.obs = self.rna.obs.assign(**{
#         x: self.rna.obs[x].astype("category")})

# high_sen_cts = [i for i in self.rna.obs["Senescence_CellType"].unique(
#     ) if " 1% " in i]

Descriptives of SnCs¶

In [10]:
print("Percent Senescent: \n\n", round(self.rna.obs.groupby([
    col_celltype, col_batch]).apply(lambda x: x["Senescent_Cell"].astype(
        int).value_counts(normalize=True)[1], include_groups=False) * 100,
    2).unstack(col_celltype))
sns.catplot(self.rna.obs, y="Senescent_Cell", x=col_celltype,
            hue=col_batch, kind="bar", height=10)
Percent Senescent: 

 annotation_by_overlap      Excitatory  Inhibitory  Microglial  Oligodendrocyte  Astrocyte   OPC  Excitatory-Inhibitory
Group                                                                                                                 
Ground Control | 12 Weeks        1.01        1.01        1.01             1.01       1.00  1.02                   1.05
Ground Control | 29 Weeks        1.73        1.76        1.85             1.27       0.96  2.55                   2.35
Space Flight | 12 Weeks          0.65        2.58        1.66             2.09       0.46  3.73                   3.77
Space Flight | 29 Weeks          2.33        1.87        2.56             1.84       1.96  3.75                   1.00
Out[10]:
<seaborn.axisgrid.FacetGrid at 0x73c607a50ad0>
No description has been provided for this image

SnC DEGs¶

In [ ]:
self.find_markers(col_celltype="Senescent_Cell_Label_by_Type")
df_snc_markers = self.get_markers_df(
    n_genes=50, col_celltype="Senescent_Cell_Label_by_Type",
    log2fc_threshold=1, p_threshold=1e-10)
print(df_snc_markers.loc[pd.unique([
    i[0] for i in df_snc_markers.index.values if ("SnC" in i[0])])].groupby(
        "Senescent_Cell_Label_by_Type").apply(lambda x: x.head(3)))
for x in self.rna.obs[col_celltype].unique():
No description has been provided for this image
Out[ ]:
scores logfoldchanges pvals pvals_adj
Senescent_Cell_Label_by_Type Senescent_Cell_Label_by_Type names
SnC Astrocyte SnC Astrocyte Zbtb20 27.045067 2.925831 2.509168e-44 2.062052e-43
Ptn 12.652748 3.181505 1.966155e-21 1.410711e-20
Nfia 12.566462 2.662537 2.847718e-21 2.040809e-20
SnC Excitatory SnC Excitatory Nrg1 39.431129 2.263098 1.104108e-176 1.335639e-173
Meg3 17.437487 1.237427 2.882203e-56 1.025471e-53
Kcnip4 12.480145 1.157420 3.237619e-32 2.543213e-30
SnC Excitatory-Inhibitory SnC Excitatory-Inhibitory Ntng1 71.276108 5.574868 5.427843e-45 1.265137e-43
Meg3 31.826820 2.392547 5.288524e-31 1.213952e-29
Snhg11 31.340244 2.166353 9.192460e-31 2.106083e-29
SnC Inhibitory SnC Inhibitory Meg3 46.909836 1.721173 1.207903e-180 4.058889e-178
Cntnap2 32.584690 2.046545 5.359733e-120 1.117874e-117
Snhg11 30.802677 1.519162 3.577045e-113 6.761175e-111
SnC Microglial SnC Microglial Cst3 44.654442 6.191420 1.530109e-49 5.533552e-49
C1qb 32.851158 8.059837 2.288986e-41 8.175335e-41
Srgap2 27.586052 4.312108 6.239606e-37 2.203167e-36
SnC OPC SnC OPC Vcan 34.304527 6.757289 1.943715e-48 2.060747e-47
Lsamp 33.169975 2.359746 4.641531e-48 4.908094e-47
Lhfpl3 31.666264 4.883138 5.424560e-46 5.716106e-45
SnC Oligodendrocyte SnC Oligodendrocyte Plp1 118.745720 5.659093 9.354708e-248 9.573934e-247
Mbp 64.255020 4.209384 1.718122e-168 1.665394e-167
Nkain2 55.394459 2.498176 2.500771e-154 2.345102e-153

Plot¶

Comparison¶

In [241]:
scores = self.rna.obs[[col_batch] + [
    f"score_{x}" for x in sen_metrics]].set_index(
        col_batch, append=True).reset_index()
sns.pairplot(scores, diag_kind="kde", diag_kws=dict(
    cut=0, fill=True, common_norm=True),
             hue=col_batch, palette=palette[col_batch])
Out[241]:
<seaborn.axisgrid.PairGrid at 0x77a44d9c1d30>
No description has been provided for this image

Scores¶

In [246]:
# UMAP with Senescence Scores
bnds = self.rna.obs["senscore"].describe(percentiles=[0.75, 0.99])
_ = self.plot(kind="umap", color=["senscore", col_celltype], umap=dict(
    palette=None, color_map="Reds", vmin=bnds["75%"], vmax=bnds["99%"]))

# Violin Plot of Senescence Scores
_ = self.plot(kind="violin", genes=["senscore"], common_norm=True,
              col_celltype=col_celltype, rotation=90)
_ = self.plot(kind="violin", genes=["senscore"], common_norm=True,
              by_group=col_celltype, col_wrap=1,
              col_celltype=col_batch, rotation=90)

# KDEs
fig_sen_kde = {}
for x in [col_age, col_condition, col_batch]:
    fig_sen_kde[x] = sns.displot(self.rna.obs, hue=x, x="senscore",
                                 palette=palette[x], kind="kde",
                                 cut=0, common_norm=True, fill=True)

# Overall (All Cell Types)
fig_sen_overall = sns.catplot(self.rna.obs, x=col_condition,
                              hue=col_age, y="senscore",
                              palette=palette[col_age],
                              kind="violin")
fig_sen_overall_2 = sns.catplot(self.rna.obs, x=col_age, hue=col_condition,
                                palette=palette[col_condition],
                                y="senscore", kind="violin")

# By Cell Type
fig_sen_rc = sns.catplot(self.rna.obs, col=col_celltype, y="senscore",
                         palette=palette[col_condition],
                         hue=col_condition, x=col_age, kind="violin",
                         height=10, aspect=2, col_wrap=3)
fig_sen = sns.catplot(self.rna.obs, x=col_celltype, y="senscore",
                      palette=palette[col_batch],
                      hue=col_batch, kind="box", height=10, aspect=2)
for a in fig_sen.axes.flatten():
    a.tick_params(axis="x", labelrotation=90)
fig_sen_2 = sns.catplot(self.rna.obs, x=col_celltype, y="senscore",
                        col=col_age, hue=col_condition,
                        palette=palette[col_condition],
                        kind="box", height=10, aspect=2)
for a in fig_sen_2.axes.flatten():
    a.tick_params(axis="x", labelrotation=90)
fig_sen_3 = sns.catplot(self.rna.obs, x=col_celltype, y="senscore",
                        col=col_condition, hue=col_age,
                        palette=palette[col_age],
                        kind="box", height=10, aspect=2)
for a in fig_sen_3.axes.flatten():
    a.tick_params(axis="x", labelrotation=90)
No description has been provided for this image
No description has been provided for this image
None
<Figure size 640x480 with 0 Axes>
Excitatory
No description has been provided for this image
Excitatory-Inhibitory
No description has been provided for this image
Oligodendrocyte
No description has been provided for this image
Inhibitory
No description has been provided for this image
Microglial
No description has been provided for this image
OPC
No description has been provided for this image
Astrocyte
No description has been provided for this image
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image

Burden¶

Group by sample and cell type and get percentage of senescent cells

In [12]:
grps = [col_sample, col_celltype, col_age, col_condition, col_batch]
dff = self.rna.obs[grps + ["Senescent_Cell"]].groupby(grps).apply(
    lambda x: x["Senescent_Cell"].mean(), include_groups=False
    ).to_frame("Senescent_Cell_Burden") * 100
# kws_plot = dict(kind="violin", split=False, , common_norm=True)
kws_plot = dict(kind="box", errorbar=("ci", 95))

sns.catplot(y="Senescent_Cell_Burden", x=col_condition, **kws_plot,
            palette=palette[col_condition],
            hue=col_condition, data=dff, height=3, aspect=1.5)
sns.catplot(y="Senescent_Cell_Burden", x=col_condition, **kws_plot,
            col=col_celltype, col_wrap=4,
            palette=palette[col_age],
            hue=col_age, data=dff, height=3, aspect=1.5)
sns.catplot(y="Senescent_Cell_Burden", hue=col_condition, **kws_plot,
            col=col_celltype, col_wrap=4,
            palette=palette[col_condition],
            x=col_age, data=dff, height=3, aspect=1.5)
sns.catplot(y="Senescent_Cell_Burden", x=col_celltype, **kws_plot,
            palette=palette[col_batch],
            hue=col_batch, data=dff, height=8, aspect=1.5)
for x in [col_condition, col_age, [col_condition, col_age]]:
    print("\n\n", round(dff["Senescent_Cell_Burden"].groupby(x).describe()[[
        "min", "25%", "50%", "75%", "max"]], 1))
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)

                 min  25%  50%  75%  max
Condition                              
Ground Control  0.0  0.4  1.0  1.9  6.0
Space Flight    0.0  0.8  1.8  2.7  8.0


           min  25%  50%  75%  max
Age_End                          
20 Weeks  0.0  0.4  1.2  2.0  5.8
37 Weeks  0.0  0.5  1.6  2.3  8.0


                          min  25%  50%  75%  max
Condition      Age_End                          
Ground Control 20 Weeks  0.0  0.3  0.8  1.7  4.5
               37 Weeks  0.0  0.5  1.2  2.3  6.0
Space Flight   20 Weeks  0.0  0.8  1.9  3.2  5.8
               37 Weeks  0.0  0.8  1.7  2.3  8.0
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image

Analyze¶

Regressions & ANOVAs & MEMs¶

In [13]:
r_dff = polars.DataFrame(dff.reset_index())  # pymer-compatible aggregated df
r_rna = polars.DataFrame(self.rna.obs.copy())  # pymer-compatible cell-level df
lvls = ["key_control", "key_treatment"]
factors = {col_condition: [keys[col_condition][i] for i in lvls],
           col_age: [keys[col_age][i] for i in lvls]}

Scores¶

In [17]:
# # Age + Condition
# model_ca_mlm = lmer(f"senscore ~ {col_condition} + {col_age} +"
#                     f"(1 | {col_sample})", data=r_rna)  # setup model
# model_ca_mlm.set_factors(factors)
# model_ca_mlm.set_transforms({"senscore": "zscore"})
# model_ca_mlm.anova(summary=True).show()

# # Age * Condition
# model_ca_mlm_i = lmer(
#     f"senscore ~ {col_condition} * {col_age} + "
#     f"(1 | {col_sample})", data=r_rna)  # setup model
# model_ca_mlm_i.set_factors(factors)
# model_ca_mlm_i.set_transforms({"senscore": "zscore"})
# model_ca_mlm_i.anova(summary=True).show()

# # Age + Condition + Cell Type
# model_cac_mlm = lmer(
#     f"senscore ~  {col_age} + {col_condition} + {col_celltype} + "
#     f"(1 | {col_sample})", data=r_rna)  # setup model
# model_cac_mlm.set_factors(factors)
# model_cac_mlm.set_transforms({"senscore": "zscore"})
# model_cac_mlm.anova(summary=True).show()

# # Age + Condition * Cell Type
# model_cac_mlm_i = lmer(
#     f"senscore ~  {col_age} + {col_condition} * {col_celltype} + "
#     f"(1 | {col_sample})", data=r_rna)  # setup model
# model_cac_mlm_i.set_factors(factors)
# model_cac_mlm_i.set_transforms({"senscore": "zscore"})
# model_cac_mlm_i.anova(summary=True).show()
# # print(model_cac_mlm_i.report())
# res_em = model_cac_mlm_i.emmeans(col_condition, by=col_celltype)
# res_em = pd.DataFrame(res_em, columns=res_em.columns).set_index(
#     res_em.columns[:2]).map(lambda x: x if isinstance(x, str) or np.isinf(
#         x) else round(x, 2))
# res_em = res_em.drop(["asymp_LCL", "asymp_UCL"], axis=1).join(res_em[[
#     "asymp_LCL", "asymp_UCL"]].apply(
#         lambda x: f"[{x.iloc[0]}, {x.iloc[1]}]", axis=1).to_frame("CI"))
# print(res_em.unstack(col_condition))

# Age * Condition * Cell Type
model_cac_mlm_i3 = lmer(
    f"senscore ~  {col_age} * {col_condition} * {col_celltype} + "
    f"(1 | {col_sample})", data=r_rna)  # setup model
model_cac_mlm_i3.set_factors(factors)
model_cac_mlm_i3.set_transforms({"senscore": "zscore"})
model_cac_mlm_i3.anova(summary=True).show()

# Age * Condition (Condition as Random Effect)
model_ca_mlm_ii = lmer(
    f"senscore ~ {col_condition} * {col_age} + "
    f"(1 | {col_sample}) + (1 + {col_condition} | {col_celltype})",
    data=r_rna)  # setup model
model_ca_mlm_ii.set_factors(factors)
model_ca_mlm_ii.set_transforms({"senscore": "zscore"})
model_ca_mlm_ii.anova(summary=True).show()

# Age * Condition (Age and Condition as Random Effect)
model_ca_mlm_iii = lmer(
    f"senscore ~ {col_condition} * {col_age} + (1 | {col_sample})"
    f" + (1 + {col_condition} + {col_age} | {col_celltype})",
    data=r_rna)  # setup model
model_ca_mlm_iii.set_factors(factors)
model_ca_mlm_iii.set_transforms({"senscore": "zscore"})
model_ca_mlm_iii.anova(summary=True).show()

# Compare
compare(
    # model_ca_mlm, model_ca_mlm_i, model_cac_mlm, model_cac_mlm_i,
    model_cac_mlm_i3, model_ca_mlm_ii, model_ca_mlm_iii).show()

# GLM Version of Results
# model_ca_mlm_i.summary().show()
# model_cac_mlm_i.summary().show()
model_cac_mlm_i3.summary().show()
model_ca_mlm_ii.summary().show()
model_ca_mlm_iii.summary().show()
ANOVA (Type III tests)
model term df1 df2 F_ratio Chisq p_value
Age_End 1.000 inf 2.781 2.781 0.09538 .
Condition 1.000 inf 11.624 11.624 <.001 ***
annotation_by_overlap 6.000 inf 2,007.061 12,042.366 ***
Age_End:Condition 1.000 inf 0.000 0.000 0.9975
Age_End:annotation_by_overlap 6.000 inf 13.785 82.710 <.001 ***
Condition:annotation_by_overlap 6.000 inf 52.540 315.240 <.001 ***
Age_End:Condition:annotation_by_overlap 6.000 inf 14.504 87.024 <.001 ***
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
ANOVA (Type III tests)
model term df1 df2 F_ratio Chisq p_value
Condition 1.000 inf 5.989 5.989 0.0144 *
Age_End 1.000 inf 3.628 3.628 0.05683 .
Condition:Age_End 1.000 inf 0.267 0.267 0.6053
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
R messages: 
Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
To enable adjustments, add the argument 'lmerTest.limit = 103274' (or larger)
[or, globally, 'set emm_options(lmerTest.limit = 103274)' or larger];
but be warned that this may result in large computation time and memory use.

R messages: 
Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
To enable adjustments, add the argument 'lmerTest.limit = 103274' (or larger)
[or, globally, 'set emm_options(lmerTest.limit = 103274)' or larger];
but be warned that this may result in large computation time and memory use.

ANOVA (Type III tests)
model term df1 df2 F_ratio Chisq p_value
Condition 1.000 inf 6.266 6.266 0.01231 *
Age_End 1.000 inf 2.311 2.311 0.1284
Condition:Age_End 1.000 inf 0.254 0.254 0.6145
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
Analysis of Deviance Table
Model 1: lmer(senscore~Age_EndConditionannotation_by_overlap+(1|sample))
Model 2: lmer(senscore~ConditionAge_End+(1|sample)+(1+Condition|annotation_by_overlap))
Model 3: lmer(senscore~Condition
Age_End+(1|sample)+(1+Condition+Age_End|annotation_by_overlap))
AIC BIC logLik npar -2*log(L) Chisq Df Pr(>Chisq)
1.00 277483.5 277769.8 −138711.7 9.00 277.52K
2.00 277548.2 277634.1 −138765.1 12.00 277.45K 65.46 3.00 <.001 ***
3.00 277488.8 277603.3 −138732.4 30.00 277.28K 177.96 18.00 <.001 ***
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
Formula: lmer(senscore~Age_End*Condition*annotation_by_overlap+(1|sample))
Number of observations: 103274
Confidence intervals: parametric
---------------------
Log-likelihood: -138711
AIC: 277483 | BIC: 277769
Residual error: 0.926
Random Effects: Estimate SE CI-low CI-high T-stat DF p
sample-sd (Intercept) 0.156
Residual-sd Observation 0.926
Fixed Effects:
(Intercept) −0.075 0.070 −0.226 0.076 −1.070 14.224 0.3025
Age_End37 Weeks 0.230 0.106 0.004 0.456 2.178 14.129 0.04687 *
ConditionSpace Flight 0.121 0.106 −0.105 0.348 1.144 14.375 0.2713
annotation_by_overlapInhibitory −0.245 0.014 −0.272 −0.218 −17.907 103,243.694 <.001 ***
annotation_by_overlapMicroglial 0.731 0.028 0.677 0.785 26.502 103,233.445 <.001 ***
annotation_by_overlapOligodendrocyte −0.450 0.015 −0.480 −0.421 −29.905 103,239.753 <.001 ***
annotation_by_overlapAstrocyte 0.490 0.019 0.453 0.527 25.775 103,235.512 <.001 ***
annotation_by_overlapOPC 0.132 0.030 0.074 0.191 4.444 103,234.599 <.001 ***
annotation_by_overlapExcitatory-Inhibitory −0.633 0.030 −0.692 −0.573 −20.904 103,237.636 <.001 ***
Age_End37 Weeks:ConditionSpace Flight −0.083 0.150 −0.403 0.237 −0.554 14.273 0.5879
Age_End37 Weeks:annotation_by_overlapInhibitory −0.019 0.020 −0.058 0.019 −0.993 103,150.566 0.3209
Age_End37 Weeks:annotation_by_overlapMicroglial −0.078 0.041 −0.159 0.003 −1.877 103,244.047 0.06054 .
Age_End37 Weeks:annotation_by_overlapOligodendrocyte −0.106 0.022 −0.149 −0.062 −4.718 103,211.773 <.001 ***
Age_End37 Weeks:annotation_by_overlapAstrocyte −0.141 0.029 −0.198 −0.085 −4.900 103,245.175 <.001 ***
Age_End37 Weeks:annotation_by_overlapOPC −0.163 0.045 −0.252 −0.075 −3.603 103,242.886 <.001 ***
Age_End37 Weeks:annotation_by_overlapExcitatory-Inhibitory −0.230 0.059 −0.346 −0.114 −3.883 103,244.313 <.001 ***
ConditionSpace Flight:annotation_by_overlapInhibitory 0.067 0.024 0.019 0.114 2.764 103,196.150 0.005714 **
ConditionSpace Flight:annotation_by_overlapMicroglial 0.340 0.044 0.253 0.427 7.663 103,240.892 <.001 ***
ConditionSpace Flight:annotation_by_overlapOligodendrocyte 0.120 0.025 0.070 0.170 4.748 103,243.306 <.001 ***
ConditionSpace Flight:annotation_by_overlapAstrocyte 0.016 0.035 −0.052 0.083 0.449 103,243.711 0.6537
ConditionSpace Flight:annotation_by_overlapOPC 0.387 0.049 0.291 0.483 7.891 103,238.966 <.001 ***
ConditionSpace Flight:annotation_by_overlapExcitatory-Inhibitory 0.004 0.052 −0.098 0.106 0.077 103,245.119 0.9386
Age_End37 Weeks:ConditionSpace Flight:annotation_by_overlapInhibitory −0.068 0.033 −0.132 −0.003 −2.064 103,173.362 0.03905 *
Age_End37 Weeks:ConditionSpace Flight:annotation_by_overlapMicroglial 0.072 0.065 −0.054 0.199 1.118 103,243.812 0.2634
Age_End37 Weeks:ConditionSpace Flight:annotation_by_overlapOligodendrocyte −0.062 0.035 −0.131 0.008 −1.741 103,217.073 0.08165 .
Age_End37 Weeks:ConditionSpace Flight:annotation_by_overlapAstrocyte 0.355 0.049 0.260 0.451 7.317 103,245.919 <.001 ***
Age_End37 Weeks:ConditionSpace Flight:annotation_by_overlapOPC 0.141 0.071 0.001 0.281 1.979 103,242.401 0.04783 *
Age_End37 Weeks:ConditionSpace Flight:annotation_by_overlapExcitatory-Inhibitory 0.144 0.091 −0.035 0.323 1.578 103,245.625 0.1146
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
Formula: lmer(senscore~Condition*Age_End+(1|sample)+(1+Condition|annotation_by_overlap))
Number of observations: 103274
Confidence intervals: parametric
---------------------
Log-likelihood: -138765
AIC: 277548 | BIC: 277634
Residual error: 0.927
Random Effects: Estimate SE CI-low CI-high T-stat DF p
sample-sd (Intercept) 0.156
annotation_by_overlap-sd (Intercept) 0.494
annotation_by_overlap-sd ConditionSpace Flight 0.176
annotation_by_overlap-cor (Intercept) 0.652
Residual-sd Observation 0.927
Fixed Effects:
(Intercept) −0.089 0.199 −0.552 0.374 −0.445 7.711 0.6687
ConditionSpace Flight 0.283 0.125 0.023 0.544 2.274 19.689 0.03435 *
Age_End37 Weeks 0.180 0.105 −0.045 0.406 1.714 13.852 0.1088
ConditionSpace Flight:Age_End37 Weeks −0.077 0.149 −0.396 0.242 −0.517 13.910 0.6134
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
Formula: lmer(senscore~Condition*Age_End+(1|sample)+(1+Condition+Age_End|annotation_by_overlap))
Number of observations: 103274
Confidence intervals: parametric
---------------------
Log-likelihood: -138732
AIC: 277488 | BIC: 277603
Residual error: 0.926
Random Effects: Estimate SE CI-low CI-high T-stat DF p
sample-sd (Intercept) 0.155
annotation_by_overlap-sd (Intercept) 0.482
annotation_by_overlap-sd ConditionSpace Flight 0.172
annotation_by_overlap-sd Age_End37 Weeks 0.064
annotation_by_overlap-cor (Intercept) 0.674
annotation_by_overlap-cor (Intercept) 0.589
annotation_by_overlap-cor ConditionSpace Flight −0.200
Residual-sd Observation 0.926
Fixed Effects:
(Intercept) −0.081 0.195 −0.533 0.370 −0.418 7.774 0.6872
ConditionSpace Flight 0.284 0.123 0.027 0.542 2.306 19.655 0.03212 *
Age_End37 Weeks 0.156 0.107 −0.073 0.384 1.451 15.287 0.1671
ConditionSpace Flight:Age_End37 Weeks −0.074 0.148 −0.392 0.243 −0.504 13.890 0.6224
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1

Binary Snc/Not¶

Multilevel Logistic Regression

In [14]:
glmmod = {}
# for x in ["1", f"1 + {col_condition}", f"1 + {col_condition} + {col_age}"]:
#     fff = str(f"Senescent_Cell ~ {col_age} * {col_condition}"
#               f" + (1 | {col_sample}) + ({x} | {col_celltype})")
for x in ["1", f"1 + Spaceflight", f"1 + Spaceflight + Aged"]:
    sep = "|" if x == "1" else "||"
    fff = str(f"Senescent_Cell ~ Aged * Spaceflight"
              f" + (1 | {col_sample}) + ({x} {sep} {col_celltype})")
    glmmod[x] = glmer(fff, data=r_rna, family="binomial")
    # glmmod[x].set_factors(factors)
    glmmod[x].fit(exponentiate=True, ncpus=ncpus)  # estimates => odds
    # print(glmmod[x].emmeans(col_condition))
    # print(glmmod[x].emmeans(col_age))
    glmmod[x].summary().show()
    print(glmmod[x].ranef[col_celltype])
compare(*[glmmod[x] for x in glmmod])

# Plot
# grid = sns.FacetGrid(self.rna.obs, col=col_age, hue=col_condition)
# grid.map(sns.countplot, "Senescent_Cell", order=[False, True])
# grid.add_legend()
# grid.set_xlabels("")
# grid.set_xticklabels(["Not SnC", "Snc"])
# sns.despine()
# fig = plt.figure(figsize=(10, 2))
# g_s = fig.add_gridspec(1, 2, width_ratios=[1, 3])
# left, right = fig.add_subplot(g_s[0]), fig.add_subplot(g_s[1])
# left = sns.kdeplot(x="resid", data=glmmod.data, ax=left)
# left.set(xlabel="Residuals", title="Error Distribution")
# right.stem(glmmod.data["cooksd"], basefmt=" ", label="Cook's Distance")
# right.set(xlabel="Row Number", ylabel="Cook's Distance",
#           title="Influential Observations",
#           xticks=range(glmmod.data.height))
# sns.despine()
Formula: glmer(Senescent_Cell~Aged*Spaceflight+(1|sample)+(1|annotation_by_overlap))
Family: binomial (link: default)
Number of observations: 103274
Confidence intervals: parametric
---------------------
Log-likelihood: -8098
AIC: 16209 | BIC: 16266
Residual error: 1.0
Random Effects: Estimate CI-low CI-high SE Z-stat df p
sample-sd (Intercept) 0.576
annotation_by_overlap-sd (Intercept) 0.258
Fixed Effects:
(Intercept) 0.008 0.005 0.014 0.002 −18.014 inf <.001 ***
Aged 1.930 0.984 3.785 0.663 1.913 inf 0.05575 .
Spaceflight 2.252 1.131 4.485 0.792 2.309 inf 0.02095 *
Aged:Spaceflight 0.648 0.266 1.579 0.294 −0.955 inf 0.3395
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
shape: (7, 2)
┌───────────────────────┬─────────────┐
│ level                 ┆ (Intercept) │
│ ---                   ┆ ---         │
│ str                   ┆ f64         │
╞═══════════════════════╪═════════════╡
│ Excitatory            ┆ 0.818122    │
│ Inhibitory            ┆ 0.990964    │
│ Microglial            ┆ 1.030949    │
│ Oligodendrocyte       ┆ 0.92749     │
│ Astrocyte             ┆ 0.709976    │
│ OPC                   ┆ 1.485906    │
│ Excitatory-Inhibitory ┆ 1.255562    │
└───────────────────────┴─────────────┘
Formula: glmer(Senescent_Cell~Aged*Spaceflight+(1|sample)+(1+Spaceflight||annotation_by_overlap))
Family: binomial (link: default)
Number of observations: 103274
Confidence intervals: parametric
---------------------
Log-likelihood: -8097
AIC: 16208 | BIC: 16275
Residual error: 1.0
Random Effects: Estimate CI-low CI-high SE Z-stat df p
sample-sd (Intercept) 0.578
annotation_by_overlap-sd (Intercept) 0.199
annotation_by_overlap.1-sd Spaceflight 0.190
Fixed Effects:
(Intercept) 0.008 0.005 0.014 0.002 −16.655 inf <.001 ***
Aged 1.907 0.832 4.373 0.808 1.525 inf 0.1274
Spaceflight 2.353 1.022 5.418 1.001 2.012 inf 0.04427 *
Aged:Spaceflight 0.667 0.216 2.059 0.384 −0.704 inf 0.4816
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
shape: (7, 3)
┌───────────────────────┬─────────────┬─────────────┐
│ level                 ┆ (Intercept) ┆ Spaceflight │
│ ---                   ┆ ---         ┆ ---         │
│ str                   ┆ f64         ┆ f64         │
╞═══════════════════════╪═════════════╪═════════════╡
│ Excitatory            ┆ 0.904116    ┆ 0.812104    │
│ Inhibitory            ┆ 1.00822     ┆ 0.975283    │
│ Microglial            ┆ 1.033172    ┆ 0.994406    │
│ Oligodendrocyte       ┆ 0.91031     ┆ 1.053992    │
│ Astrocyte             ┆ 0.771405    ┆ 0.873702    │
│ OPC                   ┆ 1.308158    ┆ 1.248044    │
│ Excitatory-Inhibitory ┆ 1.178191    ┆ 1.113457    │
└───────────────────────┴─────────────┴─────────────┘
Formula: glmer(Senescent_Cell~Aged*Spaceflight+(1|sample)+(1+Spaceflight+Aged||annotation_by_overlap))
Family: binomial (link: default)
Number of observations: 103274
Confidence intervals: parametric
---------------------
Log-likelihood: -8092
AIC: 16201 | BIC: 16277
Residual error: 1.0
Random Effects: Estimate CI-low CI-high SE Z-stat df p
sample-sd (Intercept) 0.577
annotation_by_overlap-sd (Intercept) 0.242
annotation_by_overlap.1-sd Spaceflight 0.183
annotation_by_overlap.2-sd Aged 0.209
Fixed Effects:
(Intercept) 0.008 0.005 0.014 0.002 −17.589 inf <.001 ***
Aged 1.901 0.871 4.151 0.757 1.613 inf 0.1067
Spaceflight 2.323 1.144 4.716 0.839 2.332 inf 0.0197 *
Aged:Spaceflight 0.674 0.245 1.856 0.348 −0.763 inf 0.4454
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
shape: (7, 4)
┌───────────────────────┬─────────────┬─────────────┬──────────┐
│ level                 ┆ (Intercept) ┆ Spaceflight ┆ Aged     │
│ ---                   ┆ ---         ┆ ---         ┆ ---      │
│ str                   ┆ f64         ┆ f64         ┆ f64      │
╞═══════════════════════╪═════════════╪═════════════╪══════════╡
│ Excitatory            ┆ 0.771457    ┆ 0.804849    ┆ 1.278735 │
│ Inhibitory            ┆ 1.07736     ┆ 0.994875    ┆ 0.875142 │
│ Microglial            ┆ 0.999886    ┆ 0.989842    ┆ 1.109774 │
│ Oligodendrocyte       ┆ 1.006319    ┆ 1.069577    ┆ 0.803853 │
│ Astrocyte             ┆ 0.746049    ┆ 0.8915      ┆ 1.025683 │
│ OPC                   ┆ 1.31507     ┆ 1.21047     ┆ 1.094022 │
│ Excitatory-Inhibitory ┆ 1.254969    ┆ 1.101261    ┆ 0.900711 │
└───────────────────────┴─────────────┴─────────────┴──────────┘
Out[14]:
Analysis of Deviance Table
Model 1: glmer(Senescent_Cell~AgedSpaceflight+(1|sample)+(1|annotation_by_overlap))
Model 2: glmer(Senescent_Cell~Aged
Spaceflight+(1|sample)+(1+Spaceflight||annotation_by_overlap))
Model 3: glmer(Senescent_Cell~Aged*Spaceflight+(1|sample)+(1+Spaceflight+Aged||annotation_by_overlap))
AIC BIC logLik npar -2*log(L) Chisq Df Pr(>Chisq)
1.00 16209.7 16267 −8098.9 6.00 16.20K
2.00 16208.6 16275.4 −8097.3 7.00 16.19K 3.10 1.00 0.0782 .
3.00 16201.2 16277.6 −8092.6 8.00 16.19K 9.42 1.00 0.00215 **
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1

Burden (Percent SnC)¶

ANOVA: Percent SnCs across (a) Condition x Age and (b) Condition x Age x Cell Type

In [15]:
# Age + Condition
model_1 = lm(
    f"Senescent_Cell_Burden ~ {col_condition} + {col_age}", data=r_dff)
model_1.set_factors(factors)
model_1.anova(summary=True).show()
model_1.summary().show()

# Age + Condition +  Cell Type
model_2 = lm(
    f"Senescent_Cell_Burden ~ {col_condition} + {col_age} + {col_celltype}",
    data=r_dff)
model_2.set_factors(factors)
model_2.anova(summary=True).show()
model_2.summary().show()

# Age + Condition * Cell Type
model_3 = lm(
    f"Senescent_Cell_Burden ~ {col_age} + {col_condition} * {col_celltype}",
    data=r_dff)
model_3.set_factors(factors)
model_3.anova(summary=True).show()

# # Age * Condition * Cell Type
# model_4 = lm(
#     f"Senescent_Cell_Burden ~ {col_age} * {col_condition} * {col_celltype}",
#     data=r_dff)
# model_4.set_factors(factors)
# model_4.anova(summary=True).show()
# model_4.summary().show()

# Compare
# compare(model_1, model_2, model_3, model_4).show()
compare(model_1, model_2, model_3).show()
# compare(model_1, model_2).show()
ANOVA (Type III tests)
model term df1 df2 F_ratio p_value
Condition 1 121 6.324 0.01322 *
Age_End 1 121 0.487 0.4865
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
Formula: lm(Senescent_Cell_Burden~Condition+Age_End)
Number of observations: 124
Confidence intervals: parametric
---------------------
R-squared: 0.0569
R-squared-adj: 0.0413
F(2, 121) = 3.65, p = 0.0289
Log-likelihood: -224
AIC: 456 | BIC: 468
Residual error: 1.497
Estimate SE CI-low CI-high T-stat df p
(Intercept) 1.250 0.224 0.807 1.693 5.587 121 <.001 ***
ConditionSpace Flight 0.681 0.271 0.145 1.216 2.515 121 0.01322 *
Age_End37 Weeks 0.189 0.271 −0.347 0.725 0.698 121 0.4865
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
ANOVA (Type III tests)
model term df1 df2 F_ratio p_value
Condition 1 115 6.623 0.01134 *
Age_End 1 115 0.541 0.4634
annotation_by_overlap 6 115 1.995 0.07193 .
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
Formula: lm(Senescent_Cell_Burden~Condition+Age_End+annotation_by_overlap)
Number of observations: 124
Confidence intervals: parametric
---------------------
R-squared: 0.1458
R-squared-adj: 0.0864
F(8, 115) = 2.454, p = 0.0172
Log-likelihood: -218
AIC: 456 | BIC: 484
Residual error: 1.461
Estimate SE CI-low CI-high T-stat df p
(Intercept) 0.837 0.387 0.071 1.603 2.164 115 0.03253 *
ConditionSpace Flight 0.680 0.264 0.157 1.203 2.574 115 0.01134 *
Age_End37 Weeks 0.195 0.264 −0.329 0.718 0.736 115 0.4634
annotation_by_overlapInhibitory 0.447 0.487 −0.518 1.412 0.918 115 0.3606
annotation_by_overlapMicroglial 0.435 0.487 −0.530 1.400 0.894 115 0.3733
annotation_by_overlapOligodendrocyte 0.288 0.487 −0.677 1.253 0.592 115 0.5553
annotation_by_overlapAstrocyte −0.193 0.487 −1.158 0.772 −0.396 115 0.6928
annotation_by_overlapOPC 1.329 0.487 0.365 2.294 2.729 115 0.007348 **
annotation_by_overlapExcitatory-Inhibitory 0.583 0.502 −0.412 1.578 1.160 115 0.2484
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
ANOVA (Type III tests)
model term df1 df2 F_ratio p_value
Age_End 1 109 0.537 0.4652
Condition 1 109 6.274 0.01373 *
annotation_by_overlap 6 109 1.955 0.07829 .
Condition:annotation_by_overlap 6 109 0.618 0.7154
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
Analysis of Deviance Table
Model 1: lm(Senescent_Cell_Burden~Condition+Age_End)
Model 2: lm(Senescent_Cell_Burden~Condition+Age_End+annotation_by_overlap)
Model 3: lm(Senescent_Cell_Burden~Age_End+Condition*annotation_by_overlap)
AIC BIC logLik Res_Df RSS Df Sum of Sq F Pr(>F)
1.00 456.9 468.2 −224.5 121.00 271.18
2.00 456.6 484.8 −218.3 115.00 245.61 6.00 25.57 1.96 0.0783 .
3.00 464.5 509.6 −216.2 109.00 237.53 6.00 8.08 0.62 0.715
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1

SnC (Binary) by Cell Type¶

With Cell Type REs¶

In [27]:
fff = str(f"Senescent_Cell ~ Aged + Spaceflight * {col_celltype} + "
          f"(1 | sample) +  (1 + Spaceflight + Aged || {col_celltype})")
glmmod_ct = glmer(fff, data=r_rna, family="binomial")
glmmod_ct.fit(exponentiate=True, ncpus=ncpus)  # estimates => odds
glmmod_ct.summary().show()
R messages: 
boundary (singular) fit: see help('isSingular')

R messages: 
boundary (singular) fit: see help('isSingular')

R messages: 
boundary (singular) fit: see help('isSingular')

Formula: glmer(Senescent_Cell~Aged+Spaceflight*annotation_by_overlap+(1|sample)+(1+Spaceflight+Aged||annotation_by_overlap))
Family: binomial (link: default)
Number of observations: 103274
Confidence intervals: parametric
---------------------
Log-likelihood: -8079
AIC: 16197 | BIC: 16378
Residual error: 1.0
Random Effects: Estimate CI-low CI-high SE Z-stat df p
sample-sd (Intercept) 0.578
annotation_by_overlap-sd (Intercept) 0.000
annotation_by_overlap.1-sd Spaceflight 0.000
annotation_by_overlap.2-sd Aged 0.205
Fixed Effects:
(Intercept) 0.007 0.004 0.011 0.002 −21.812 inf <.001 ***
Aged 1.551 0.910 2.645 0.422 1.613 inf 0.1068
Spaceflight 1.460 0.843 2.528 0.409 1.350 inf 0.177
annotation_by_overlapInhibitory 1.421 1.118 1.806 0.174 2.868 inf 0.004129 **
annotation_by_overlapMicroglial 1.322 0.883 1.977 0.272 1.357 inf 0.1748
annotation_by_overlapOligodendrocyte 1.294 0.977 1.715 0.186 1.796 inf 0.07245 .
annotation_by_overlapAstrocyte 0.917 0.656 1.281 0.156 −0.507 inf 0.6122
annotation_by_overlapOPC 1.723 1.135 2.617 0.367 2.553 inf 0.01068 *
annotation_by_overlapExcitatory-Inhibitory 1.754 1.077 2.854 0.436 2.260 inf 0.02385 *
Spaceflight:annotation_by_overlapInhibitory 1.289 0.989 1.680 0.174 1.880 inf 0.06014 .
Spaceflight:annotation_by_overlapMicroglial 1.267 0.770 2.083 0.322 0.932 inf 0.3515
Spaceflight:annotation_by_overlapOligodendrocyte 1.441 1.066 1.949 0.222 2.373 inf 0.01765 *
Spaceflight:annotation_by_overlapAstrocyte 1.084 0.693 1.696 0.247 0.355 inf 0.7228
Spaceflight:annotation_by_overlapOPC 1.863 1.161 2.988 0.449 2.580 inf 0.009885 **
Spaceflight:annotation_by_overlapExcitatory-Inhibitory 1.566 0.865 2.834 0.474 1.482 inf 0.1385
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1

Without Cell Type REs¶

In [251]:
fff = str(f"Senescent_Cell ~ Aged + Spaceflight * {col_celltype} + "
          "(1 | sample)")
glmmod_ct2 = glmer(fff, data=r_rna, family="binomial")
glmmod_ct2.fit(exponentiate=True, ncpus=ncpus)  # estimates => odds
glmmod_ct2.summary().show()
Formula: glmer(Senescent_Cell~Aged+Spaceflight*annotation_by_overlap+(1|sample))
Family: binomial (link: default)
Number of observations: 103274
Confidence intervals: parametric
---------------------
Log-likelihood: -8083
AIC: 16199 | BIC: 16352
Residual error: 1.0
Random Effects: Estimate CI-low CI-high SE Z-stat df p
sample-sd (Intercept) 0.581
Fixed Effects:
(Intercept) 0.008 0.005 0.013 0.002 −19.803 inf <.001 ***
Aged 1.563 0.896 2.727 0.444 1.572 inf 0.116
Spaceflight 1.491 0.846 2.625 0.431 1.382 inf 0.167
annotation_by_overlapInhibitory 1.105 0.925 1.321 0.100 1.097 inf 0.2725
annotation_by_overlapMicroglial 1.165 0.807 1.683 0.219 0.816 inf 0.4143
annotation_by_overlapOligodendrocyte 0.963 0.777 1.192 0.105 −0.349 inf 0.7275
annotation_by_overlapAstrocyte 0.799 0.596 1.072 0.120 −1.498 inf 0.1342
annotation_by_overlapOPC 1.459 1.014 2.098 0.271 2.037 inf 0.04167 *
annotation_by_overlapExcitatory-Inhibitory 1.371 0.852 2.207 0.333 1.299 inf 0.1941
Spaceflight:annotation_by_overlapInhibitory 1.245 0.954 1.625 0.169 1.613 inf 0.1068
Spaceflight:annotation_by_overlapMicroglial 1.235 0.731 2.085 0.330 0.788 inf 0.4305
Spaceflight:annotation_by_overlapOligodendrocyte 1.417 1.046 1.918 0.219 2.250 inf 0.02445 *
Spaceflight:annotation_by_overlapAstrocyte 1.069 0.671 1.702 0.254 0.280 inf 0.7794
Spaceflight:annotation_by_overlapOPC 1.822 1.121 2.962 0.452 2.422 inf 0.01544 *
Spaceflight:annotation_by_overlapExcitatory-Inhibitory 1.562 0.804 3.036 0.530 1.317 inf 0.188
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1

Just Age as Predictor¶

In [38]:
model_cac_mlm_i3_a = lmer(
    f"senscore ~  {col_age} * {col_celltype} + (1 | {col_sample})",
    data=r_rna)  # setup model
model_cac_mlm_i3_a.set_factors(factors)
model_cac_mlm_i3_a.set_transforms({"senscore": "zscore"})
model_cac_mlm_i3_a.fit()
model_cac_mlm_i3_a.summary().show()

fff = str(f"Senescent_Cell ~ Aged * {col_celltype} + "
          "(1 | sample)")
glmmod_ct2a = glmer(fff, data=r_rna, family="binomial")
glmmod_ct2a.fit(exponentiate=True, ncpus=ncpus)  # estimates => odds
glmmod_ct2a.summary().show()
Formula: lmer(senscore~Age_End*annotation_by_overlap+(1|sample))
Number of observations: 103274
Confidence intervals: parametric
---------------------
Log-likelihood: -138881
AIC: 277795 | BIC: 277947
Residual error: 0.928
Random Effects: Estimate SE CI-low CI-high T-stat DF p
sample-sd (Intercept) 0.166
Residual-sd Observation 0.928
Fixed Effects:
(Intercept) −0.014 0.056 −0.132 0.104 −0.244 16.336 0.81
Age_End37 Weeks 0.199 0.079 0.032 0.365 2.519 16.267 0.0226 *
annotation_by_overlapInhibitory −0.223 0.011 −0.245 −0.201 −19.724 103,257.788 <.001 ***
annotation_by_overlapMicroglial 0.861 0.022 0.818 0.903 39.821 103,249.264 ***
annotation_by_overlapOligodendrocyte −0.409 0.012 −0.432 −0.385 −33.734 103,258.553 <.001 ***
annotation_by_overlapAstrocyte 0.498 0.016 0.467 0.529 31.269 103,253.186 <.001 ***
annotation_by_overlapOPC 0.274 0.024 0.228 0.321 11.560 103,248.370 <.001 ***
annotation_by_overlapExcitatory-Inhibitory −0.631 0.025 −0.680 −0.583 −25.543 103,253.754 <.001 ***
Age_End37 Weeks:annotation_by_overlapInhibitory −0.040 0.016 −0.070 −0.009 −2.525 103,223.181 0.01158 *
Age_End37 Weeks:annotation_by_overlapMicroglial −0.033 0.032 −0.095 0.030 −1.027 103,255.054 0.3042
Age_End37 Weeks:annotation_by_overlapOligodendrocyte −0.126 0.017 −0.160 −0.092 −7.286 103,249.497 <.001 ***
Age_End37 Weeks:annotation_by_overlapAstrocyte −0.000 0.023 −0.045 0.045 −0.003 103,259.812 0.9978
Age_End37 Weeks:annotation_by_overlapOPC −0.077 0.035 −0.145 −0.008 −2.194 103,253.684 0.02826 *
Age_End37 Weeks:annotation_by_overlapExcitatory-Inhibitory −0.172 0.045 −0.260 −0.085 −3.847 103,257.305 <.001 ***
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
Formula: glmer(Senescent_Cell~Aged*annotation_by_overlap+(1|sample))
Family: binomial (link: default)
Number of observations: 103274
Confidence intervals: parametric
---------------------
Log-likelihood: -8078
AIC: 16187 | BIC: 16331
Residual error: 1.0
Random Effects: Estimate CI-low CI-high SE Z-stat df p
sample-sd (Intercept) 0.644
Fixed Effects:
(Intercept) 0.008 0.005 0.012 0.002 −21.425 inf <.001 ***
Aged 2.315 1.255 4.272 0.724 2.687 inf 0.007214 **
annotation_by_overlapInhibitory 1.687 1.353 2.103 0.190 4.653 inf <.001 ***
annotation_by_overlapMicroglial 1.410 0.929 2.142 0.301 1.612 inf 0.1069
annotation_by_overlapOligodendrocyte 1.678 1.320 2.132 0.205 4.228 inf <.001 ***
annotation_by_overlapAstrocyte 0.951 0.662 1.367 0.176 −0.270 inf 0.7869
annotation_by_overlapOPC 2.452 1.680 3.579 0.473 4.650 inf <.001 ***
annotation_by_overlapExcitatory-Inhibitory 2.595 1.782 3.780 0.498 4.972 inf <.001 ***
Aged:annotation_by_overlapInhibitory 0.610 0.463 0.804 0.086 −3.511 inf <.001 ***
Aged:annotation_by_overlapMicroglial 0.930 0.539 1.604 0.259 −0.262 inf 0.7934
Aged:annotation_by_overlapOligodendrocyte 0.532 0.388 0.729 0.086 −3.922 inf <.001 ***
Aged:annotation_by_overlapAstrocyte 0.852 0.532 1.364 0.205 −0.666 inf 0.5053
Aged:annotation_by_overlapOPC 0.755 0.459 1.241 0.191 −1.109 inf 0.2675
Aged:annotation_by_overlapExcitatory-Inhibitory 0.403 0.207 0.784 0.137 −2.675 inf 0.007467 **
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1

Three-Way Interaction¶

In [15]:
# Score
# Binary
fff = str(f"senscore ~ {col_celltype} * Aged * Spaceflight"
          f" + (1 | {col_sample})")
model_allix_score = lmer(fff, data=r_rna)
model_allix_score.fit(ncpus=ncpus)  # estimates => odds
model_allix_score.anova(summary=True).show()
model_allix_score.summary().show()

# Binary
fff = str(f"Senescent_Cell ~  {col_celltype} * Aged * Spaceflight"
          f" + (1 | {col_sample})")
model_allix = glmer(fff, data=r_rna, family="binomial")
model_allix.fit(exponentiate=True, ncpus=ncpus)  # estimates => odds
model_allix.anova(summary=True).show()
model_allix.summary().show()
res_allix_fixed = pd.DataFrame(model_allix.result_fit[[
    "term", "estimate", "p_value"]], columns=[
        "Term", "OR", "P"]).set_index("Term")
res_allix_fixed.loc[:, "Log-Odds"] = np.log(res_allix_fixed.OR.astype(float))
res_allix_fixed.loc[:, "Significance"] = res_allix_fixed.P.apply(
    lambda x: "***" if x < 0.001 else "**" if x < 0.01 else "*" if (
        x < 0.05) else "")
res_allix_fixed
R messages: 
Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
To enable adjustments, add the argument 'lmerTest.limit = 103274' (or larger)
[or, globally, 'set emm_options(lmerTest.limit = 103274)' or larger];
but be warned that this may result in large computation time and memory use.

R messages: 
Note: D.f. calculations have been disabled because the number of observations exceeds 3000.
To enable adjustments, add the argument 'lmerTest.limit = 103274' (or larger)
[or, globally, 'set emm_options(lmerTest.limit = 103274)' or larger];
but be warned that this may result in large computation time and memory use.

ANOVA (Type III tests)
model term df1 df2 F_ratio Chisq p_value
annotation_by_overlap 6.000 inf 2,007.061 12,042.366 ***
Aged 1.000 inf 2.781 2.781 0.09538 .
Spaceflight 1.000 inf 11.624 11.624 <.001 ***
annotation_by_overlap:Aged 6.000 inf 13.785 82.710 <.001 ***
annotation_by_overlap:Spaceflight 6.000 inf 52.540 315.240 <.001 ***
Aged:Spaceflight 1.000 inf 0.000 0.000 0.9975
annotation_by_overlap:Aged:Spaceflight 6.000 inf 14.504 87.024 <.001 ***
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
Formula: lmer(senscore~annotation_by_overlap*Aged*Spaceflight+(1|sample))
Number of observations: 103274
Confidence intervals: parametric
---------------------
Log-likelihood: 138206
AIC: -276352 | BIC: -276066
Residual error: 0.063
Random Effects: Estimate SE CI-low CI-high T-stat DF p
sample-sd (Intercept) 0.011
Residual-sd Observation 0.063
Fixed Effects:
(Intercept) −0.027 0.005 −0.037 −0.016 −5.532 14.224 <.001 ***
annotation_by_overlapInhibitory −0.017 0.001 −0.019 −0.015 −17.907 103,243.694 <.001 ***
annotation_by_overlapMicroglial 0.050 0.002 0.046 0.054 26.502 103,233.445 <.001 ***
annotation_by_overlapOligodendrocyte −0.031 0.001 −0.033 −0.029 −29.905 103,239.753 <.001 ***
annotation_by_overlapAstrocyte 0.034 0.001 0.031 0.036 25.775 103,235.512 <.001 ***
annotation_by_overlapOPC 0.009 0.002 0.005 0.013 4.444 103,234.599 <.001 ***
annotation_by_overlapExcitatory-Inhibitory −0.043 0.002 −0.047 −0.039 −20.904 103,237.636 <.001 ***
Aged 0.016 0.007 0.000 0.031 2.178 14.129 0.04687 *
Spaceflight 0.008 0.007 −0.007 0.024 1.144 14.375 0.2713
annotation_by_overlapInhibitory:Aged −0.001 0.001 −0.004 0.001 −0.993 103,150.561 0.3209
annotation_by_overlapMicroglial:Aged −0.005 0.003 −0.011 0.000 −1.877 103,244.047 0.06054 .
annotation_by_overlapOligodendrocyte:Aged −0.007 0.002 −0.010 −0.004 −4.718 103,211.772 <.001 ***
annotation_by_overlapAstrocyte:Aged −0.010 0.002 −0.014 −0.006 −4.900 103,245.175 <.001 ***
annotation_by_overlapOPC:Aged −0.011 0.003 −0.017 −0.005 −3.603 103,242.886 <.001 ***
annotation_by_overlapExcitatory-Inhibitory:Aged −0.016 0.004 −0.024 −0.008 −3.883 103,244.313 <.001 ***
annotation_by_overlapInhibitory:Spaceflight 0.005 0.002 0.001 0.008 2.764 103,196.150 0.005714 **
annotation_by_overlapMicroglial:Spaceflight 0.023 0.003 0.017 0.029 7.663 103,240.892 <.001 ***
annotation_by_overlapOligodendrocyte:Spaceflight 0.008 0.002 0.005 0.012 4.748 103,243.306 <.001 ***
annotation_by_overlapAstrocyte:Spaceflight 0.001 0.002 −0.004 0.006 0.449 103,243.711 0.6537
annotation_by_overlapOPC:Spaceflight 0.026 0.003 0.020 0.033 7.891 103,238.966 <.001 ***
annotation_by_overlapExcitatory-Inhibitory:Spaceflight 0.000 0.004 −0.007 0.007 0.077 103,245.119 0.9386
Aged:Spaceflight −0.006 0.010 −0.028 0.016 −0.554 14.273 0.5879
annotation_by_overlapInhibitory:Aged:Spaceflight −0.005 0.002 −0.009 −0.000 −2.064 103,173.360 0.03905 *
annotation_by_overlapMicroglial:Aged:Spaceflight 0.005 0.004 −0.004 0.014 1.118 103,243.812 0.2634
annotation_by_overlapOligodendrocyte:Aged:Spaceflight −0.004 0.002 −0.009 0.001 −1.741 103,217.072 0.08165 .
annotation_by_overlapAstrocyte:Aged:Spaceflight 0.024 0.003 0.018 0.031 7.317 103,245.919 <.001 ***
annotation_by_overlapOPC:Aged:Spaceflight 0.010 0.005 0.000 0.019 1.979 103,242.401 0.04783 *
annotation_by_overlapExcitatory-Inhibitory:Aged:Spaceflight 0.010 0.006 −0.002 0.022 1.578 103,245.625 0.1146
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
R messages: 
Convergence status
: [1] FALSE
attr(,"gradient")
[1] 0.001041441

R messages: 
Convergence status
: [1] FALSE
attr(,"gradient")
[1] 0.001041441

ANOVA (Type III tests)
model term df1 df2 F_ratio Chisq p_value
annotation_by_overlap 6.000 inf 9.367 56.202 <.001 ***
Aged 1.000 inf 2.623 2.623 0.1053
Spaceflight 1.000 inf 4.065 4.065 0.04378 *
annotation_by_overlap:Aged 6.000 inf 5.508 33.048 <.001 ***
annotation_by_overlap:Spaceflight 6.000 inf 3.346 20.076 0.002681 **
Aged:Spaceflight 1.000 inf 0.330 0.330 0.5654
annotation_by_overlap:Aged:Spaceflight 6.000 inf 7.459 44.754 <.001 ***
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
Formula: glmer(Senescent_Cell~annotation_by_overlap*Aged*Spaceflight+(1|sample))
Family: binomial (link: default)
Number of observations: 103274
Confidence intervals: parametric
---------------------
Log-likelihood: -8046
AIC: 16151 | BIC: 16428
Residual error: 1.0
Random Effects: Estimate CI-low CI-high SE Z-stat df p
sample-sd (Intercept) 0.566
Fixed Effects:
(Intercept) 0.007 0.004 0.012 0.002 −18.077 inf <.001 ***
annotation_by_overlapInhibitory 0.990 0.745 1.315 0.143 −0.072 inf 0.9423
annotation_by_overlapMicroglial 1.057 0.593 1.883 0.312 0.187 inf 0.8517
annotation_by_overlapOligodendrocyte 1.184 0.864 1.622 0.190 1.051 inf 0.2932
annotation_by_overlapAstrocyte 0.979 0.659 1.453 0.197 −0.107 inf 0.9151
annotation_by_overlapOPC 1.185 0.619 2.271 0.393 0.513 inf 0.6081
annotation_by_overlapExcitatory-Inhibitory 1.487 0.816 2.709 0.455 1.296 inf 0.1948
Aged 1.937 0.873 4.295 0.787 1.627 inf 0.1037
Spaceflight 0.912 0.384 2.163 0.402 −0.210 inf 0.8338
annotation_by_overlapInhibitory:Aged 1.227 0.852 1.768 0.228 1.101 inf 0.2709
annotation_by_overlapMicroglial:Aged 1.207 0.563 2.589 0.470 0.484 inf 0.6284
annotation_by_overlapOligodendrocyte:Aged 0.674 0.437 1.041 0.149 −1.780 inf 0.07506 .
annotation_by_overlapAstrocyte:Aged 0.645 0.354 1.177 0.198 −1.429 inf 0.153
annotation_by_overlapOPC:Aged 1.426 0.623 3.260 0.602 0.840 inf 0.4008
annotation_by_overlapExcitatory-Inhibitory:Aged 0.842 0.342 2.073 0.387 −0.374 inf 0.7082
annotation_by_overlapInhibitory:Spaceflight 3.990 2.388 6.667 1.045 5.282 inf <.001 ***
annotation_by_overlapMicroglial:Spaceflight 2.383 0.973 5.838 1.089 1.900 inf 0.05746 .
annotation_by_overlapOligodendrocyte:Spaceflight 2.660 1.539 4.596 0.742 3.505 inf <.001 ***
annotation_by_overlapAstrocyte:Spaceflight 0.705 0.258 1.925 0.361 −0.681 inf 0.4958
annotation_by_overlapOPC:Spaceflight 4.920 2.078 11.647 2.163 3.623 inf <.001 ***
annotation_by_overlapExcitatory-Inhibitory:Spaceflight 3.770 1.576 9.017 1.677 2.983 inf 0.002858 **
Aged:Spaceflight 1.634 0.502 5.321 0.984 0.816 inf 0.4146
annotation_by_overlapInhibitory:Aged:Spaceflight 0.174 0.093 0.323 0.055 −5.524 inf <.001 ***
annotation_by_overlapMicroglial:Aged:Spaceflight 0.446 0.142 1.407 0.261 −1.377 inf 0.1685
annotation_by_overlapOligodendrocyte:Aged:Spaceflight 0.467 0.234 0.932 0.165 −2.160 inf 0.03075 *
annotation_by_overlapAstrocyte:Aged:Spaceflight 2.310 0.706 7.558 1.397 1.384 inf 0.1663
annotation_by_overlapOPC:Aged:Spaceflight 0.245 0.082 0.735 0.137 −2.508 inf 0.01213 *
annotation_by_overlapExcitatory-Inhibitory:Aged:Spaceflight 0.155 0.029 0.818 0.132 −2.196 inf 0.02811 *
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1
Out[15]:
OR P Log-Odds Significance
Term
(Intercept) 0.007257 0.0 -4.925800 ***
annotation_by_overlapInhibitory 0.989572 0.942323 -0.010483
annotation_by_overlapMicroglial 1.056651 0.851745 0.055105
annotation_by_overlapOligodendrocyte 1.1839 0.293218 0.168814
annotation_by_overlapAstrocyte 0.97873 0.915072 -0.021499
annotation_by_overlapOPC 1.185386 0.608123 0.170068
annotation_by_overlapExcitatory-Inhibitory 1.486958 0.194837 0.396733
Aged 1.936852 0.103733 0.661064
Spaceflight 0.911654 0.833786 -0.092494
annotation_by_overlapInhibitory:Aged 1.22744 0.270895 0.204931
annotation_by_overlapMicroglial:Aged 1.207347 0.628373 0.188426
annotation_by_overlapOligodendrocyte:Aged 0.674097 0.075064 -0.394381
annotation_by_overlapAstrocyte:Aged 0.645351 0.152988 -0.437960
annotation_by_overlapOPC:Aged 1.425591 0.400752 0.354586
annotation_by_overlapExcitatory-Inhibitory:Aged 0.84194 0.708198 -0.172047
annotation_by_overlapInhibitory:Spaceflight 3.98989 0.0 1.383764 ***
annotation_by_overlapMicroglial:Spaceflight 2.383131 0.057459 0.868415
annotation_by_overlapOligodendrocyte:Spaceflight 2.659605 0.000457 0.978178 ***
annotation_by_overlapAstrocyte:Spaceflight 0.705464 0.49579 -0.348899
annotation_by_overlapOPC:Spaceflight 4.919576 0.000291 1.593222 ***
annotation_by_overlapExcitatory-Inhibitory:Spaceflight 3.76993 0.002858 1.327056 **
Aged:Spaceflight 1.634474 0.414581 0.491321
annotation_by_overlapInhibitory:Aged:Spaceflight 0.173642 0.0 -1.750761 ***
annotation_by_overlapMicroglial:Aged:Spaceflight 0.446422 0.168462 -0.806491
annotation_by_overlapOligodendrocyte:Aged:Spaceflight 0.466986 0.030751 -0.761456 *
annotation_by_overlapAstrocyte:Aged:Spaceflight 2.309757 0.166317 0.837142
annotation_by_overlapOPC:Aged:Spaceflight 0.244922 0.012127 -1.406815 *
annotation_by_overlapExcitatory-Inhibitory:Aged:Spaceflight 0.154854 0.028111 -1.865273 *

Perturbation Distance¶

In [16]:
print(f"\n\n{'=' * 80}\nOverall Distance\n{'=' * 80}\n\n")
df_distance, figs_distance = scflow.ax.analyze_perturbation_distance(
    self.rna, col_condition=[col_age, col_condition, col_batch])

print(f"\n\n{'=' * 80}\nJust Senescence Genes\n{'=' * 80}\n\n")
df_distance_snc, figs_distance_snc = scflow.ax.analyze_perturbation_distance(
    self.rna[:, genes], col_condition=[
        col_age, col_condition, col_batch])
Output()

================================================================================
Overall Distance
================================================================================



Output()

Output()

No description has been provided for this image
No description has been provided for this image
No description has been provided for this image

================================================================================
Just Senescence Genes
================================================================================


Output()

Output()

Output()

Output()

No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image

Composition Analysis¶

Cell Type¶

In [ ]:
print(f"\n\n{'=' * 80}\nOverall Sample\n{'=' * 80}\n\n")
out_ctc = scflow.ax.analyze_composition(
    self.rna, col_celltype, col_batch, col_sample=col_sample,
    palette=palette[col_batch],
    formula=None, key_modality="coda", reference_cell_type="automatic",
    absence_threshold=0.1, est_fdr=0.1, level_order=[keys[
        col_batch]["key_control"]] + keys[col_batch]["key_treatment"])
plt.show()

print(f"\n\n{'=' * 80}\nAged Subset\n{'=' * 80}\n\n")
out_ctc_sf = scflow.ax.analyze_composition(
    self.rna[self.rna.obs[col_age] != keys[col_age]["key_control"]],
    col_celltype, col_condition, col_sample=col_sample,
    formula=None, key_modality="coda", reference_cell_type="automatic",
    absence_threshold=0.1, est_fdr=0.1, level_order=[keys[col_condition][
        "key_control"]] + [keys[col_condition]["key_treatment"]])

Senescent Cells¶

Tree-Aggregated¶

In [11]:
# col_celltype_hierarchy = [
#     "Senescent_Cell_Label", f"SnC_hierarchy",
#     "Senescent_Cell_Label_by_Type"]
col_celltype_hierarchy = [
    f"{col_celltype}_hierarchical", "SnC_hierarchy",
    "Senescent_Cell_Label_by_Type"]
ref_celltype = self.rna.obs["Senescent_Cell_Label_by_Type"].value_counts(
    ).index.values[0]
form_c = " + ".join([col_condition, col_age]) + " + " + " * ".join([
    col_condition, col_age])
By Just SF¶
In [18]:
_ = scflow.ax.analyze_composition_tree(
    self.rna, col_celltype_hierarchy[-1], col_condition,
    col_sample=col_sample, formula=None, seed=0, est_fdr=0.2,
    reference_cell_type=ref_celltype, num_warmup=2000,
    col_celltype_hierarchy=col_celltype_hierarchy)
# if overwrite is True or os.path.exists(
#         f"outputs/tasccoda_results.pkl") is False:
#     print(f"Writing to outputs/tasccoda_results.pkl")
#     with open(f"outputs/tasccoda_results.pkl", "wb") as f:
#         pickle.dump(out_ctc_ct_tree[0], f)
#     # out_ctc_ct_tree[1].write_h5mu(f"outputs/tasccoda_data.h5mu")
<string>:20: DeprecationWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, pd.CategoricalDtype) instead
• Zero counts encountered in data! Added a pseudocount of 0.5.
sample: 100%|█| 12000/12000 [01:11<00:00, 168.59it/s, 15 steps of size 2.22e-01
                                          Compositional Analysis summary                                           
┌──────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────┐
│ Name                             │ Value                                                                        │
├──────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────┤
│ Data                             │ Data: 18 samples, 14 cell types                                              │
│ Reference cell type              │ Excitatory                                                                   │
│ Formula                          │ Condition                                                                    │
│ Reference index                  │ [8, 2, 0]                                                                    │
│ MCMC Sampling                    │ Sampled 10000 chain states (2000 burnin samples)                             │
│ Acceptance rate                  │ 89.7%                                                                        │
└──────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Intercepts                                                                                                      │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                               Final Parameter  HDI 3%  HDI 97%   SD   Expected Sample                           │
│ Senescent_Cell_Label_by_Type                                                                                    │
│ Astrocyte                          1.674        1.363   1.966  0.161      484.005                               │
│ Excitatory                         3.066        2.848   3.309  0.123     1947.097                               │
│ Excitatory-Inhibitory              0.060       -0.344   0.450  0.214       96.360                               │
│ Inhibitory                         2.789        2.540   3.067  0.139     1476.005                               │
│ Microglial                         1.028        0.720   1.332  0.165      253.685                               │
│ OPC                                0.830        0.487   1.145  0.177      208.116                               │
│ Oligodendrocyte                    2.446        2.174   2.694  0.139     1047.430                               │
│ SnC Astrocyte                     -1.258       -1.714  -0.788  0.248       25.793                               │
│ SnC Excitatory                    -0.951       -1.394  -0.494  0.239       35.061                               │
│ SnC Excitatory-Inhibitory         -1.499       -1.968  -1.032  0.252       20.269                               │
│ SnC Inhibitory                    -0.595       -1.022  -0.159  0.231       50.054                               │
│ SnC Microglial                    -1.298       -1.766  -0.850  0.245       24.781                               │
│ SnC OPC                           -1.252       -1.712  -0.801  0.245       25.948                               │
│ SnC Oligodendrocyte               -0.739       -1.198  -0.338  0.230       43.341                               │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects                                                                                                         │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                           Effect  Expected Sample  log2-fold change                             │
│ Covariate      Cell Type                                                                                        │
│ T.Space Flight Astrocyte                  0.000       484.005           0.000                                   │
│                Excitatory                 0.000      1947.097           0.000                                   │
│                Excitatory-Inhibitory      0.000        96.360           0.000                                   │
│                Inhibitory                 0.000      1476.005           0.000                                   │
│                Microglial                 0.000       253.685           0.000                                   │
│                OPC                        0.000       208.116           0.000                                   │
│                Oligodendrocyte            0.000      1047.430           0.000                                   │
│                SnC Astrocyte              0.000        25.793           0.000                                   │
│                SnC Excitatory             0.000        35.061           0.000                                   │
│                SnC Excitatory-Inhibitory  0.000        20.269           0.000                                   │
│                SnC Inhibitory             0.000        50.054           0.000                                   │
│                SnC Microglial             0.000        24.781           0.000                                   │
│                SnC OPC                    0.000        25.948           0.000                                   │
│                SnC Oligodendrocyte        0.000        43.341           0.000                                   │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects Extended                                                                                                │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                           Median  HDI 3%  HDI 97%   SD                                          │
│ Covariate      Cell Type                                                                                        │
│ T.Space Flight Astrocyte                   0.036  -0.217  0.240   0.118                                         │
│                Excitatory                  0.000   0.000  0.000   0.000                                         │
│                Excitatory-Inhibitory       0.040  -0.134  0.254   0.099                                         │
│                Inhibitory                 -0.001  -0.229  0.136   0.100                                         │
│                Microglial                  0.041  -0.114  0.246   0.089                                         │
│                OPC                         0.065  -0.140  0.286   0.111                                         │
│                Oligodendrocyte             0.079  -0.091  0.274   0.095                                         │
│                SnC Astrocyte               0.139  -0.145  0.467   0.159                                         │
│                SnC Excitatory              0.151  -0.134  0.464   0.158                                         │
│                SnC Excitatory-Inhibitory   0.142  -0.139  0.462   0.159                                         │
│                SnC Inhibitory              0.148  -0.117  0.475   0.158                                         │
│                SnC Microglial              0.096  -0.136  0.358   0.128                                         │
│                SnC OPC                     0.150  -0.113  0.490   0.159                                         │
│                SnC Oligodendrocyte         0.151  -0.122  0.472   0.158                                         │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Nodes                                                                                                           │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Covariate=Condition[T.Space Flight]_node                                                                        │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                            Final Parameter  Median  HDI 3%  HDI 97%  SD   Delta  Is credible                    │
│ Node                                                                                                            │
│ Non-Senescent                   0.00         0.00    0.00    0.00   0.00  0.00      False                       │
│ Senescent                       0.00         0.05   -0.08    0.23   0.08  0.13      False                       │
│ Neuron                          0.00         0.00    0.00    0.00   0.00  0.00      False                       │
│ Macroglia                       0.00         0.03   -0.10    0.17   0.07  0.13      False                       │
│ Microglial                      0.00         0.04   -0.11    0.25   0.09  0.13      False                       │
│ SnC Neuron                      0.00         0.04   -0.11    0.23   0.09  0.13      False                       │
│ SnC Macroglia                   0.00         0.04   -0.12    0.23   0.09  0.13      False                       │
│ SnC Microglial                  0.00         0.04   -0.17    0.22   0.10  0.13      False                       │
│ Excitatory                      0.00         0.00    0.00    0.00   0.00  0.00      False                       │
│ Excitatory-Inhibitory           0.00         0.04   -0.13    0.25   0.10  0.13      False                       │
│ Inhibitory                      0.00        -0.00   -0.23    0.14   0.10  0.13      False                       │
│ Oligodendrocyte                 0.00         0.05   -0.08    0.21   0.07  0.13      False                       │
│ OPC                             0.00         0.04   -0.12    0.23   0.09  0.13      False                       │
│ Astrocyte                       0.00         0.02   -0.22    0.16   0.10  0.13      False                       │
│ SnC Excitatory                  0.00         0.04   -0.16    0.24   0.10  0.13      False                       │
│ SnC Inhibitory                  0.00         0.04   -0.14    0.26   0.10  0.13      False                       │
│ SnC Excitatory-Inhibitory       0.00         0.04   -0.15    0.25   0.10  0.13      False                       │
│ SnC Oligodendrocyte             0.00         0.04   -0.13    0.26   0.10  0.13      False                       │
│ SnC Astrocyte                   0.00         0.03   -0.18    0.22   0.10  0.13      False                       │
│ SnC OPC                         0.00         0.04   -0.14    0.26   0.10  0.13      False                       │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Wrote file: /home/easlinger/AWG/ADBR/Brain_AWG/Senescence/tree_effect.png
<Figure size 0x300 with 0 Axes>
No description has been provided for this image
By SF & Age¶
In [12]:
_ = scflow.ax.analyze_composition_tree(
    self.rna, "Senescent_Cell_Label_by_Type", [col_condition, col_age],
    formula=form_c, col_sample=col_sample, seed=0,
    reference_cell_type=ref_celltype, est_fdr=0.2,
    col_celltype_hierarchy=col_celltype_hierarchy)
# if overwrite is True or os.path.exists(
#         f"outputs/tasccoda_results_ca.pkl") is False:
#     with open(f"outputs/tasccoda_results_ca.pkl", "wb") as f:
#         pickle.dump(out_ctc_ct_tree[0], f)
#     # out_ctc_ct_tree[1].write_h5mu(f"outputs/tasccoda_data_ca.h5mu")
/home/easlinger/scflow/scflow/analysis/perturbation.py:190: DeprecationWarning: is_categorical_dtype is deprecated and will be removed in a future version. Use isinstance(dtype, pd.CategoricalDtype) instead
  if pd.api.types.is_categorical_dtype(adata.obs[i]):
• Zero counts encountered in data! Added a pseudocount of 0.5.
INFO:2025-08-21 19:16:12,616:jax._src.xla_bridge:830: Unable to initialize backend 'tpu': INTERNAL: Failed to open libtpu.so: libtpu.so: cannot open shared object file: No such file or directory
2025-08-21 19:16:12 | [INFO] Unable to initialize backend 'tpu': INTERNAL: Failed to open libtpu.so: libtpu.so: cannot open shared object file: No such file or directory
sample: 100%|█| 11000/11000 [02:01<00:00, 90.63it/s, 31 steps of size 1.35e-01.
2025-08-21 19:18:20 | [INFO] arviz_base not installed
2025-08-21 19:18:20 | [INFO] arviz_stats not installed
2025-08-21 19:18:20 | [INFO] arviz_plots not installed
                                          Compositional Analysis summary                                           
┌──────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────┐
│ Name                             │ Value                                                                        │
├──────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────┤
│ Data                             │ Data: 18 samples, 14 cell types                                              │
│ Reference cell type              │ Excitatory                                                                   │
│ Formula                          │ Condition + Age_End + Condition * Age_End                                    │
│ Reference index                  │ [6, 0]                                                                       │
│ MCMC Sampling                    │ Sampled 10000 chain states (1000 burnin samples)                             │
│ Acceptance rate                  │ 92.6%                                                                        │
└──────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Intercepts                                                                                                      │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                               Final Parameter  HDI 3%  HDI 97%   SD   Expected Sample                           │
│ Senescent_Cell_Label_by_Type                                                                                    │
│ Astrocyte                          1.971        1.605   2.324  0.191      526.950                               │
│ Excitatory                         3.187        2.933   3.430  0.132     1777.752                               │
│ Excitatory-Inhibitory              0.549       -0.093   1.181  0.354      127.117                               │
│ Inhibitory                         3.013        2.685   3.331  0.172     1493.839                               │
│ Microglial                         1.178        0.819   1.540  0.190      238.437                               │
│ OPC                                1.107        0.729   1.508  0.208      222.095                               │
│ Oligodendrocyte                    2.755        2.437   3.080  0.172     1154.133                               │
│ SnC Astrocyte                     -1.179       -1.665  -0.709  0.254       22.581                               │
│ SnC Excitatory                    -0.878       -1.330  -0.420  0.246       30.512                               │
│ SnC Excitatory-Inhibitory         -1.424       -1.910  -0.935  0.261       17.674                               │
│ SnC Inhibitory                    -0.498       -0.927  -0.050  0.233       44.617                               │
│ SnC Microglial                    -1.233       -1.736  -0.787  0.253       21.394                               │
│ SnC OPC                           -1.180       -1.637  -0.689  0.253       22.558                               │
│ SnC Oligodendrocyte               -0.651       -1.124  -0.222  0.242       38.287                               │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects                                                                                                         │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                                             Effect  Expected Sample  log2-fold change           │
│ Covariate                        Cell Type                                                                      │
│ T.Space Flight                   Astrocyte                   0.000      526.950            0.000                │
│                                  Excitatory                  0.000     1777.752            0.000                │
│                                  Excitatory-Inhibitory       0.000      127.117            0.000                │
│                                  Inhibitory                  0.000     1493.839            0.000                │
│                                  Microglial                  0.000      238.437            0.000                │
│                                  OPC                         0.000      222.095            0.000                │
│                                  Oligodendrocyte             0.000     1154.133            0.000                │
│                                  SnC Astrocyte               0.000       22.581            0.000                │
│                                  SnC Excitatory              0.000       30.512            0.000                │
│                                  SnC Excitatory-Inhibitory   0.000       17.674            0.000                │
│                                  SnC Inhibitory              0.000       44.617            0.000                │
│                                  SnC Microglial              0.000       21.394            0.000                │
│                                  SnC OPC                     0.000       22.558            0.000                │
│                                  SnC Oligodendrocyte         0.000       38.287            0.000                │
│ Age_EndT.37 Weeks                Astrocyte                  -0.295      433.344           -0.282                │
│                                  Excitatory                  0.000     1963.595            0.143                │
│                                  Excitatory-Inhibitory      -0.593       77.597           -0.712                │
│                                  Inhibitory                  0.000     1650.003            0.143                │
│                                  Microglial                  0.000      263.363            0.143                │
│                                  OPC                        -0.295      182.643           -0.282                │
│                                  Oligodendrocyte            -0.295      949.117           -0.282                │
│                                  SnC Astrocyte               0.000       24.941            0.143                │
│                                  SnC Excitatory              0.000       33.701            0.143                │
│                                  SnC Excitatory-Inhibitory   0.000       19.522            0.143                │
│                                  SnC Inhibitory              0.000       49.281            0.143                │
│                                  SnC Microglial              0.000       23.630            0.143                │
│                                  SnC OPC                     0.000       24.917            0.143                │
│                                  SnC Oligodendrocyte         0.000       42.289            0.143                │
│ T.Space Flight:Age_EndT.37 Weeks Astrocyte                   0.000      526.950            0.000                │
│                                  Excitatory                  0.000     1777.752            0.000                │
│                                  Excitatory-Inhibitory       0.000      127.117            0.000                │
│                                  Inhibitory                  0.000     1493.839            0.000                │
│                                  Microglial                  0.000      238.437            0.000                │
│                                  OPC                         0.000      222.095            0.000                │
│                                  Oligodendrocyte             0.000     1154.133            0.000                │
│                                  SnC Astrocyte               0.000       22.581            0.000                │
│                                  SnC Excitatory              0.000       30.512            0.000                │
│                                  SnC Excitatory-Inhibitory   0.000       17.674            0.000                │
│                                  SnC Inhibitory              0.000       44.617            0.000                │
│                                  SnC Microglial              0.000       21.394            0.000                │
│                                  SnC OPC                     0.000       22.558            0.000                │
│                                  SnC Oligodendrocyte         0.000       38.287            0.000                │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects Extended                                                                                                │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                                             Median  HDI 3%  HDI 97%   SD                        │
│ Covariate                        Cell Type                                                                      │
│ T.Space Flight                   Astrocyte                  -0.000  -0.240   0.166  0.105                       │
│                                  Excitatory                  0.000   0.000   0.000  0.000                       │
│                                  Excitatory-Inhibitory       0.011  -0.172   0.201  0.093                       │
│                                  Inhibitory                 -0.020  -0.240   0.089  0.092                       │
│                                  Microglial                  0.011  -0.144   0.194  0.084                       │
│                                  OPC                         0.022  -0.179   0.227  0.103                       │
│                                  Oligodendrocyte             0.039  -0.119   0.227  0.089                       │
│                                  SnC Astrocyte               0.030  -0.191   0.331  0.133                       │
│                                  SnC Excitatory              0.038  -0.200   0.327  0.135                       │
│                                  SnC Excitatory-Inhibitory   0.031  -0.195   0.324  0.132                       │
│                                  SnC Inhibitory              0.034  -0.189   0.342  0.133                       │
│                                  SnC Microglial              0.010  -0.178   0.222  0.100                       │
│                                  SnC OPC                     0.036  -0.184   0.328  0.132                       │
│                                  SnC Oligodendrocyte         0.037  -0.186   0.337  0.135                       │
│ Age_EndT.37 Weeks                Astrocyte                  -0.302  -0.605   0.030  0.174                       │
│                                  Excitatory                  0.000   0.000   0.000  0.000                       │
│                                  Excitatory-Inhibitory      -0.593  -1.354   0.065  0.454                       │
│                                  Inhibitory                 -0.124  -0.442   0.048  0.148                       │
│                                  Microglial                 -0.012  -0.322   0.134  0.128                       │
│                                  OPC                        -0.293  -0.625   0.040  0.182                       │
│                                  Oligodendrocyte            -0.334  -0.633  -0.028  0.160                       │
│                                  SnC Astrocyte               0.012  -0.239   0.261  0.127                       │
│                                  SnC Excitatory              0.023  -0.217   0.281  0.126                       │
│                                  SnC Excitatory-Inhibitory   0.011  -0.261   0.248  0.129                       │
│                                  SnC Inhibitory              0.017  -0.231   0.265  0.124                       │
│                                  SnC Microglial              0.008  -0.174   0.224  0.100                       │
│                                  SnC OPC                     0.012  -0.257   0.248  0.128                       │
│                                  SnC Oligodendrocyte         0.008  -0.261   0.232  0.126                       │
│ T.Space Flight:Age_EndT.37 Weeks Astrocyte                  -0.005  -0.269   0.183  0.118                       │
│                                  Excitatory                  0.000   0.000   0.000  0.000                       │
│                                  Excitatory-Inhibitory       0.004  -0.223   0.196  0.107                       │
│                                  Inhibitory                 -0.013  -0.288   0.104  0.108                       │
│                                  Microglial                  0.003  -0.204   0.161  0.096                       │
│                                  OPC                         0.003  -0.259   0.210  0.119                       │
│                                  Oligodendrocyte             0.001  -0.229   0.189  0.106                       │
│                                  SnC Astrocyte               0.024  -0.236   0.290  0.132                       │
│                                  SnC Excitatory              0.021  -0.250   0.292  0.134                       │
│                                  SnC Excitatory-Inhibitory   0.013  -0.258   0.266  0.132                       │
│                                  SnC Inhibitory              0.015  -0.248   0.267  0.131                       │
│                                  SnC Microglial              0.010  -0.162   0.237  0.099                       │
│                                  SnC OPC                     0.024  -0.241   0.284  0.131                       │
│                                  SnC Oligodendrocyte         0.021  -0.225   0.297  0.132                       │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Nodes                                                                                                           │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Covariate=Age_End[T.37 Weeks]_node                                                                              │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                            Final Parameter  Median  HDI 3%  HDI 97%  SD   Delta  Is credible                    │
│ Node                                                                                                            │
│ Neuron                          0.00         0.00    0.00    0.00   0.00  0.00      False                       │
│ Macroglia                      -0.29        -0.29   -0.58    0.02   0.17  0.16       True                       │
│ SnC Neuron                      0.00         0.01   -0.15    0.18   0.08  0.16      False                       │
│ SnC Macroglia                   0.00         0.01   -0.19    0.16   0.08  0.16      False                       │
│ Microglial                      0.00        -0.01   -0.32    0.13   0.13  0.16      False                       │
│ SnC Microglial                  0.00         0.01   -0.17    0.22   0.10  0.16      False                       │
│ Excitatory                      0.00         0.00    0.00    0.00   0.00  0.00      False                       │
│ Excitatory-Inhibitory          -0.59        -0.59   -1.35    0.07   0.45  0.16       True                       │
│ Inhibitory                      0.00        -0.12   -0.44    0.05   0.15  0.16      False                       │
│ Oligodendrocyte                 0.00        -0.01   -0.30    0.12   0.11  0.16      False                       │
│ OPC                             0.00         0.01   -0.18    0.17   0.09  0.16      False                       │
│ Astrocyte                       0.00         0.00   -0.21    0.14   0.09  0.16      False                       │
│ SnC Excitatory                  0.00         0.01   -0.17    0.22   0.10  0.16      False                       │
│ SnC Inhibitory                  0.00         0.01   -0.17    0.21   0.10  0.16      False                       │
│ SnC Excitatory-Inhibitory       0.00         0.01   -0.21    0.20   0.10  0.16      False                       │
│ SnC Oligodendrocyte             0.00         0.01   -0.19    0.19   0.10  0.16      False                       │
│ SnC Astrocyte                   0.00         0.01   -0.18    0.21   0.10  0.16      False                       │
│ SnC OPC                         0.00         0.01   -0.20    0.19   0.10  0.16      False                       │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Covariate=Condition[T.Space Flight]:Age_End[T.37 Weeks]_node                                                    │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                            Final Parameter  Median  HDI 3%  HDI 97%  SD   Delta  Is credible                    │
│ Node                                                                                                            │
│ Neuron                          0.00         0.00    0.00    0.00   0.00  0.00      False                       │
│ Macroglia                       0.00         0.00   -0.19    0.14   0.08  0.16      False                       │
│ SnC Neuron                      0.00         0.01   -0.17    0.18   0.09  0.16      False                       │
│ SnC Macroglia                   0.00         0.01   -0.15    0.19   0.09  0.16      False                       │
│ Microglial                      0.00         0.00   -0.20    0.16   0.10  0.16      False                       │
│ SnC Microglial                  0.00         0.01   -0.16    0.24   0.10  0.16      False                       │
│ Excitatory                      0.00         0.00    0.00    0.00   0.00  0.00      False                       │
│ Excitatory-Inhibitory           0.00         0.00   -0.22    0.20   0.11  0.16      False                       │
│ Inhibitory                      0.00        -0.01   -0.29    0.10   0.11  0.16      False                       │
│ Oligodendrocyte                 0.00         0.01   -0.16    0.15   0.08  0.16      False                       │
│ OPC                             0.00         0.01   -0.19    0.17   0.09  0.16      False                       │
│ Astrocyte                       0.00         0.00   -0.20    0.14   0.09  0.16      False                       │
│ SnC Excitatory                  0.00         0.01   -0.18    0.24   0.10  0.16      False                       │
│ SnC Inhibitory                  0.00         0.01   -0.20    0.19   0.10  0.16      False                       │
│ SnC Excitatory-Inhibitory       0.00         0.01   -0.23    0.17   0.10  0.16      False                       │
│ SnC Oligodendrocyte             0.00         0.01   -0.20    0.20   0.10  0.16      False                       │
│ SnC Astrocyte                   0.00         0.01   -0.17    0.22   0.10  0.16      False                       │
│ SnC OPC                         0.00         0.01   -0.18    0.22   0.10  0.16      False                       │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│ Covariate=Condition[T.Space Flight]_node                                                                        │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                            Final Parameter  Median  HDI 3%  HDI 97%  SD   Delta  Is credible                    │
│ Node                                                                                                            │
│ Neuron                          0.00         0.00    0.00    0.00   0.00  0.00      False                       │
│ Macroglia                       0.00         0.01   -0.11    0.14   0.06  0.16      False                       │
│ SnC Neuron                      0.00         0.01   -0.13    0.23   0.09  0.16      False                       │
│ SnC Macroglia                   0.00         0.01   -0.13    0.22   0.09  0.16      False                       │
│ Microglial                      0.00         0.01   -0.14    0.19   0.08  0.16      False                       │
│ SnC Microglial                  0.00         0.01   -0.18    0.22   0.10  0.16      False                       │
│ Excitatory                      0.00         0.00    0.00    0.00   0.00  0.00      False                       │
│ Excitatory-Inhibitory           0.00         0.01   -0.17    0.20   0.09  0.16      False                       │
│ Inhibitory                      0.00        -0.02   -0.24    0.09   0.09  0.16      False                       │
│ Oligodendrocyte                 0.00         0.02   -0.09    0.21   0.08  0.16      False                       │
│ OPC                             0.00         0.01   -0.15    0.19   0.08  0.16      False                       │
│ Astrocyte                       0.00        -0.00   -0.23    0.12   0.09  0.16      False                       │
│ SnC Excitatory                  0.00         0.01   -0.15    0.25   0.10  0.16      False                       │
│ SnC Inhibitory                  0.00         0.01   -0.18    0.22   0.10  0.16      False                       │
│ SnC Excitatory-Inhibitory       0.00         0.01   -0.18    0.22   0.10  0.16      False                       │
│ SnC Oligodendrocyte             0.00         0.01   -0.15    0.25   0.10  0.16      False                       │
│ SnC Astrocyte                   0.00         0.01   -0.18    0.21   0.10  0.16      False                       │
│ SnC OPC                         0.00         0.01   -0.17    0.22   0.10  0.16      False                       │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/pertpy/tools/_coda/_base_coda.py:1990: PerformanceWarning: indexing past lexsort depth may impact performance.
  node_effs = data.uns["scCODA_params"]["node_df"].loc[(covariate + "_node",),].copy()
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/pertpy/tools/_coda/_base_coda.py:2000: PerformanceWarning: indexing past lexsort depth may impact performance.
  leaf_effs = eff_df.loc[(covariate,),].copy()
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/pertpy/tools/_coda/_base_coda.py:1990: PerformanceWarning: indexing past lexsort depth may impact performance.
  node_effs = data.uns["scCODA_params"]["node_df"].loc[(covariate + "_node",),].copy()
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/pertpy/tools/_coda/_base_coda.py:2000: PerformanceWarning: indexing past lexsort depth may impact performance.
  leaf_effs = eff_df.loc[(covariate,),].copy()
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/pertpy/tools/_coda/_base_coda.py:1990: PerformanceWarning: indexing past lexsort depth may impact performance.
  node_effs = data.uns["scCODA_params"]["node_df"].loc[(covariate + "_node",),].copy()
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/pertpy/tools/_coda/_base_coda.py:2000: PerformanceWarning: indexing past lexsort depth may impact performance.
  leaf_effs = eff_df.loc[(covariate,),].copy()
Wrote file: /home/easlinger/AWG/ADBR/Brain_AWG/Senescence/tree_effect.png
Wrote file: /home/easlinger/AWG/ADBR/Brain_AWG/Senescence/tree_effect.png
Wrote file: /home/easlinger/AWG/ADBR/Brain_AWG/Senescence/tree_effect.png
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image

scCoda¶

In [ ]:
# print(f"\n\n{'=' * 80}\nOverall Sample\n{'=' * 80}\n\n")
# out_ctc = scflow.ax.analyze_composition(
#     self.rna, "Senescent_Cell_Label", col_batch, col_sample=col_sample,
#     formula=None, key_modality="coda", reference_cell_type="Non-Senescent",
#     palette=palette[col_batch],
#     absence_threshold=0.1, est_fdr=0.1, seed=1618, level_order=[keys[
#         col_batch]["key_control"]] + keys[col_batch]["key_treatment"])
# plt.show()

# print(f"\n\n{'=' * 80}\nAged Subset\n{'=' * 80}\n\n")
# out_ctc_old = scflow.ax.analyze_composition(
#     self.rna[self.rna.obs[col_age] == keys[col_age]["key_treatment"]],
#     "Senescent_Cell_Label", col_condition, col_sample=col_sample,
#     palette=palette[col_batch],
#     formula=None, key_modality="coda", reference_cell_type="Non-Senescent",
#     absence_threshold=0.1, est_fdr=0.1, level_order=[keys[
#         col_condition]["key_control"]] + [
#             keys[col_condition]["key_treatment"]])

print(f"\n\n{'=' * 80}\nBy Cell Type\n{'=' * 80}\n\n")
out_ctc_ct = {}
for x in self.rna.obs[col_celltype].unique():
    out_ctc_ct[x] = scflow.ax.analyze_composition(
        self.rna[self.rna.obs[col_celltype] == x],
        "Senescent_Cell_Label_by_Type", col_batch, col_sample=col_sample,
        formula=None, key_modality="coda", full_hmc=False,
        palette=palette[col_batch], seed=1618,
        num_samples=10000, num_warmup=1000,
        reference_cell_type=x, absence_threshold=0.1, est_fdr=0.1,
        level_order=[keys[col_batch]["key_control"]] + keys[
            col_batch]["key_treatment"])
    if overwrite is True or os.path.exists(
            f"outputs/scccoda_results_{x}.pkl") is False:
        with open(f"outputs/sccoda_results_{x}.pkl", "wb") as f:
            pickle.dump(out_ctc_ct[x][0], f)
        out_ctc_ct[x][1].write_h5mu(f"outputs/sccoda_data_{x}.h5mu")
    plt.show()

# print(f"\n\n{'=' * 80}\nBy Cell Type (Aged Subset)\n{'=' * 80}\n\n")
# ref_cell = self.rna.obs[col_celltype].value_counts().index.values[0]
# out_ctc = scflow.ax.analyze_composition(
#     self.rna[self.rna.obs[col_age] == keys[col_age]["key_treatment"]],
#     "Senescent_Cell_Label_by_Type", col_condition,
#     palette=palette[col_batch],
#     col_sample=col_sample, formula=None, absence_threshold=0.1, est_fdr=0.1,
#     level_order=[keys[col_condition]["key_control"]] + [
#         keys[col_condition]["key_treatment"]])

================================================================================
By Cell Type
================================================================================


• Zero counts encountered in data! Added a pseudocount of 0.5.
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
No description has been provided for this image
INFO:2025-08-21 13:59:15,704:jax._src.xla_bridge:830: Unable to initialize backend 'tpu': INTERNAL: Failed to open libtpu.so: libtpu.so: cannot open shared object file: No such file or directory
2025-08-21 13:59:15 | [INFO] Unable to initialize backend 'tpu': INTERNAL: Failed to open libtpu.so: libtpu.so: cannot open shared object file: No such file or directory
sample: 100%|█| 11000/11000 [37:07<00:00,  4.94it/s, 1023 steps of size 1.27e-1
2025-08-21 14:36:27 | [INFO] arviz_base not installed
2025-08-21 14:36:27 | [INFO] arviz_stats not installed
2025-08-21 14:36:27 | [INFO] arviz_plots not installed
                                          Compositional Analysis summary                                           
┌───────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────┐
│ Name                                  │ Value                                                                   │
├───────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Data                                  │ Data: 18 samples, 2 cell types                                          │
│ Reference cell type                   │ Excitatory                                                              │
│ Formula                               │ Group                                                                   │
│ Reference index                       │ 0                                                                       │
│ Spike-and-slab threshold              │ 1.000                                                                   │
│ Spike-and-slab threshold              │ 1.000                                                                   │
│ MCMC Sampling                         │ Sampled 10000 chain states (1000 burnin samples)                        │
│ Acceptance rate                       │ 94.1%                                                                   │
└───────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Intercepts                                                                                                      │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                               Final Parameter  HDI 3%  HDI 97%   SD   Expected Sample                           │
│ Senescent_Cell_Label_by_Type                                                                                    │
│ Excitatory                        37.428       37.428  37.428  0.000     2291.889                               │
│ SnC Excitatory                    -0.037       -0.037  -0.037  0.000        0.000                               │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects                                                                                                         │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                                  Final Parameter  Expected Sample  log2-fold change             │
│ Covariate                        Cell Type                                                                      │
│ GroupT.Ground Control | 29 Weeks Excitatory           0.000             0.000          -98.087                  │
│                                  SnC Excitatory     105.454          2291.889           54.051                  │
│ GroupT.Space Flight | 12 Weeks   Excitatory           0.000          2291.889           -0.000                  │
│                                  SnC Excitatory       0.130             0.000            0.187                  │
│ GroupT.Space Flight | 29 Weeks   Excitatory           0.000          2291.889           -0.000                  │
│                                  SnC Excitatory       0.066             0.000            0.095                  │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects Extended                                                                                                │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                                  HDI 3%  HDI 97%   SD   Inclusion probability                   │
│ Covariate                        Cell Type                                                                      │
│ GroupT.Ground Control | 29 Weeks Excitatory       0.000   0.000  0.000         0.000                            │
│                                  SnC Excitatory 105.446 105.446  0.000         1.000                            │
│ GroupT.Space Flight | 12 Weeks   Excitatory       0.000   0.000  0.000         0.000                            │
│                                  SnC Excitatory   0.130   0.130  0.000         1.000                            │
│ GroupT.Space Flight | 29 Weeks   Excitatory       0.000   0.000  0.000         0.000                            │
│                                  SnC Excitatory   0.066   0.066  0.000         1.000                            │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
... storing 'rna:Senescent_Cell_Label_senmayo' as categorical
... storing 'rna:Senescent_Cell_Label_senmayo_3' as categorical
... storing 'rna:Senescent_Cell_Label_by_Type_senmayo' as categorical
... storing 'rna:Senescent_Cell_Label' as categorical
... storing 'rna:Senescent_Cell_Label_by_Type' as categorical
... storing 'rna:scCODA_sample_id' as categorical
... storing 'Senescent_Cell_Label_senmayo' as categorical
... storing 'Senescent_Cell_Label_senmayo_3' as categorical
... storing 'Senescent_Cell_Label_by_Type_senmayo' as categorical
... storing 'Senescent_Cell_Label' as categorical
... storing 'Senescent_Cell_Label_by_Type' as categorical
... storing 'scCODA_sample_id' as categorical

==================================================   Credible Effects   ==================================================

 Covariate      Group[T.Ground Control | 29 Weeks] Group[T.Space Flight | 12 Weeks] Group[T.Space Flight | 29 Weeks]
Cell Type                                                                                                          
Excitatory                                                                                                         
SnC Excitatory                                  *                                *                                *

==========================================================================================================================



• Zero counts encountered in data! Added a pseudocount of 0.5.
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
No description has been provided for this image
sample: 100%|█| 11000/11000 [00:28<00:00, 391.91it/s, 1 steps of size 9.03e-02.
! Acceptance rate unusually low (0.04095195565575892 < 0.5)! Results might be incorrect! Please check feasibility of results and re-run the sampling step with a different rng_key if necessary.

                                          Compositional Analysis summary                                           
┌───────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────┐
│ Name                                  │ Value                                                                   │
├───────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Data                                  │ Data: 16 samples, 2 cell types                                          │
│ Reference cell type                   │ Excitatory-Inhibitory                                                   │
│ Formula                               │ Group                                                                   │
│ Reference index                       │ 0                                                                       │
│ Spike-and-slab threshold              │ 0.811                                                                   │
│ Spike-and-slab threshold              │ 0.811                                                                   │
│ MCMC Sampling                         │ Sampled 10000 chain states (1000 burnin samples)                        │
│ Acceptance rate                       │ 4.1%                                                                    │
└───────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Intercepts                                                                                                      │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                               Final Parameter  HDI 3%  HDI 97%   SD   Expected Sample                           │
│ Senescent_Cell_Label_by_Type                                                                                    │
│ Excitatory-Inhibitory             40.143       41.364  41.559  6.830     138.969                                │
│ SnC Excitatory-Inhibitory          4.865        1.035   5.745  1.587       0.000                                │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects                                                                                                         │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                                             Final Parameter  Expected Sample  log2-fold change  │
│ Covariate                        Cell Type                                                                      │
│ GroupT.Ground Control | 29 Weeks Excitatory-Inhibitory           0.000            0.000           -58.602       │
│                                  SnC Excitatory-Inhibitory      75.898          138.969            50.895       │
│ GroupT.Space Flight | 12 Weeks   Excitatory-Inhibitory           0.000            0.000           -29.594       │
│                                  SnC Excitatory-Inhibitory      55.791          138.969            50.895       │
│ GroupT.Space Flight | 29 Weeks   Excitatory-Inhibitory           0.000          138.969             0.000       │
│                                  SnC Excitatory-Inhibitory       0.003            0.000             0.004       │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects Extended                                                                                                │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                                             HDI 3%  HDI 97%    SD    Inclusion probability      │
│ Covariate                        Cell Type                                                                      │
│ GroupT.Ground Control | 29 Weeks Excitatory-Inhibitory       0.000   0.000    0.000         0.000               │
│                                  SnC Excitatory-Inhibitory  -0.398 301.956  107.510         0.982               │
│ GroupT.Space Flight | 12 Weeks   Excitatory-Inhibitory       0.000   0.000    0.000         0.000               │
│                                  SnC Excitatory-Inhibitory  35.524 135.211   33.874         0.981               │
│ GroupT.Space Flight | 29 Weeks   Excitatory-Inhibitory       0.000   0.000    0.000         0.000               │
│                                  SnC Excitatory-Inhibitory  -0.000   0.010    0.041         0.811               │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
... storing 'rna:Senescent_Cell_Label_senmayo' as categorical
... storing 'rna:Senescent_Cell_Label_senmayo_3' as categorical
... storing 'rna:Senescent_Cell_Label_by_Type_senmayo' as categorical
... storing 'rna:Senescent_Cell_Label' as categorical
... storing 'rna:Senescent_Cell_Label_by_Type' as categorical
... storing 'rna:scCODA_sample_id' as categorical
... storing 'Senescent_Cell_Label_senmayo' as categorical
... storing 'Senescent_Cell_Label_senmayo_3' as categorical
... storing 'Senescent_Cell_Label_by_Type_senmayo' as categorical
... storing 'Senescent_Cell_Label' as categorical
... storing 'Senescent_Cell_Label_by_Type' as categorical
... storing 'scCODA_sample_id' as categorical

==================================================   Credible Effects   ==================================================

 Covariate                 Group[T.Ground Control | 29 Weeks] Group[T.Space Flight | 12 Weeks] Group[T.Space Flight | 29 Weeks]
Cell Type                                                                                                                     
Excitatory-Inhibitory                                                                                                         
SnC Excitatory-Inhibitory                                  *                                *                                *

==========================================================================================================================



/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
No description has been provided for this image
sample: 100%|█| 11000/11000 [04:13<00:00, 43.43it/s, 127 steps of size 2.59e-02
                                          Compositional Analysis summary                                           
┌───────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────┐
│ Name                                  │ Value                                                                   │
├───────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Data                                  │ Data: 18 samples, 2 cell types                                          │
│ Reference cell type                   │ Oligodendrocyte                                                         │
│ Formula                               │ Group                                                                   │
│ Reference index                       │ 0                                                                       │
│ Spike-and-slab threshold              │ 1.000                                                                   │
│ Spike-and-slab threshold              │ 1.000                                                                   │
│ MCMC Sampling                         │ Sampled 10000 chain states (1000 burnin samples)                        │
│ Acceptance rate                       │ 66.7%                                                                   │
└───────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Intercepts                                                                                                      │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                               Final Parameter  HDI 3%  HDI 97%   SD   Expected Sample                           │
│ Senescent_Cell_Label_by_Type                                                                                    │
│ Oligodendrocyte                   6.636        5.287   8.193   0.947     1014.390                               │
│ SnC Oligodendrocyte               2.244        0.995   3.570   0.843       12.554                               │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects                                                                                                         │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                                       Final Parameter  Expected Sample  log2-fold change        │
│ Covariate                        Cell Type                                                                      │
│ GroupT.Ground Control | 29 Weeks Oligodendrocyte          0.000           1014.390           0.000              │
│                                  SnC Oligodendrocyte      0.000             12.554           0.000              │
│ GroupT.Space Flight | 12 Weeks   Oligodendrocyte          0.000           1014.390           0.000              │
│                                  SnC Oligodendrocyte      0.000             12.554           0.000              │
│ GroupT.Space Flight | 29 Weeks   Oligodendrocyte          0.000           1014.390           0.000              │
│                                  SnC Oligodendrocyte      0.000             12.554           0.000              │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects Extended                                                                                                │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                                       HDI 3%  HDI 97%   SD   Inclusion probability              │
│ Covariate                        Cell Type                                                                      │
│ GroupT.Ground Control | 29 Weeks Oligodendrocyte       0.000  0.000   0.000         0.000                       │
│                                  SnC Oligodendrocyte  -0.501  0.363   0.122         0.296                       │
│ GroupT.Space Flight | 12 Weeks   Oligodendrocyte       0.000  0.000   0.000         0.000                       │
│                                  SnC Oligodendrocyte  -0.003  1.092   0.379         0.776                       │
│ GroupT.Space Flight | 29 Weeks   Oligodendrocyte       0.000  0.000   0.000         0.000                       │
│                                  SnC Oligodendrocyte  -0.050  0.765   0.335         0.662                       │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
... storing 'rna:Senescent_Cell_Label_senmayo' as categorical
... storing 'rna:Senescent_Cell_Label_senmayo_3' as categorical
... storing 'rna:Senescent_Cell_Label_by_Type_senmayo' as categorical
... storing 'rna:Senescent_Cell_Label' as categorical
... storing 'rna:Senescent_Cell_Label_by_Type' as categorical
... storing 'rna:scCODA_sample_id' as categorical
... storing 'Senescent_Cell_Label_senmayo' as categorical
... storing 'Senescent_Cell_Label_senmayo_3' as categorical
... storing 'Senescent_Cell_Label_by_Type_senmayo' as categorical
... storing 'Senescent_Cell_Label' as categorical
... storing 'Senescent_Cell_Label_by_Type' as categorical
... storing 'scCODA_sample_id' as categorical

==================================================   Credible Effects   ==================================================

 Covariate           Group[T.Ground Control | 29 Weeks] Group[T.Space Flight | 12 Weeks] Group[T.Space Flight | 29 Weeks]
Cell Type                                                                                                               
Oligodendrocyte                                                                                                         
SnC Oligodendrocyte                                                                                                     

==========================================================================================================================



/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
No description has been provided for this image
sample: 100%|█| 11000/11000 [01:19<00:00, 138.12it/s, 1 steps of size 4.38e-02.
! Acceptance rate unusually low (0.22878863250827636 < 0.5)! Results might be incorrect! Please check feasibility of results and re-run the sampling step with a different rng_key if necessary.

                                          Compositional Analysis summary                                           
┌───────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────┐
│ Name                                  │ Value                                                                   │
├───────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Data                                  │ Data: 18 samples, 2 cell types                                          │
│ Reference cell type                   │ Inhibitory                                                              │
│ Formula                               │ Group                                                                   │
│ Reference index                       │ 0                                                                       │
│ Spike-and-slab threshold              │ 0.928                                                                   │
│ Spike-and-slab threshold              │ 0.928                                                                   │
│ MCMC Sampling                         │ Sampled 10000 chain states (1000 burnin samples)                        │
│ Acceptance rate                       │ 22.9%                                                                   │
└───────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Intercepts                                                                                                      │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                               Final Parameter  HDI 3%  HDI 97%   SD    Expected Sample                          │
│ Senescent_Cell_Label_by_Type                                                                                    │
│ Inhibitory                        29.571       4.550   42.162  17.466     1454.611                              │
│ SnC Inhibitory                     3.139       0.488    5.382   2.040        0.000                              │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects                                                                                                         │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                                  Final Parameter  Expected Sample  log2-fold change             │
│ Covariate                        Cell Type                                                                      │
│ GroupT.Ground Control | 29 Weeks Inhibitory           0.000          1454.611             0.000                 │
│                                  SnC Inhibitory       0.000             0.000             0.000                 │
│ GroupT.Space Flight | 12 Weeks   Inhibitory           0.000             0.000          -314.641                 │
│                                  SnC Inhibitory     244.525          1454.611            38.133                 │
│ GroupT.Space Flight | 29 Weeks   Inhibitory           0.000          1454.611             0.000                 │
│                                  SnC Inhibitory       0.000             0.000             0.000                 │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects Extended                                                                                                │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                                  HDI 3%  HDI 97%    SD    Inclusion probability                 │
│ Covariate                        Cell Type                                                                      │
│ GroupT.Ground Control | 29 Weeks Inhibitory       0.000   0.000    0.000         0.000                          │
│                                  SnC Inhibitory  -0.201 322.862  136.410         0.842                          │
│ GroupT.Space Flight | 12 Weeks   Inhibitory       0.000   0.000    0.000         0.000                          │
│                                  SnC Inhibitory  -0.816 540.602  167.773         0.929                          │
│ GroupT.Space Flight | 29 Weeks   Inhibitory       0.000   0.000    0.000         0.000                          │
│                                  SnC Inhibitory  -0.692 382.915  134.219         0.781                          │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
... storing 'rna:Senescent_Cell_Label_senmayo' as categorical
... storing 'rna:Senescent_Cell_Label_senmayo_3' as categorical
... storing 'rna:Senescent_Cell_Label_by_Type_senmayo' as categorical
... storing 'rna:Senescent_Cell_Label' as categorical
... storing 'rna:Senescent_Cell_Label_by_Type' as categorical
... storing 'rna:scCODA_sample_id' as categorical
... storing 'Senescent_Cell_Label_senmayo' as categorical
... storing 'Senescent_Cell_Label_senmayo_3' as categorical
... storing 'Senescent_Cell_Label_by_Type_senmayo' as categorical
... storing 'Senescent_Cell_Label' as categorical
... storing 'Senescent_Cell_Label_by_Type' as categorical
... storing 'scCODA_sample_id' as categorical

==================================================   Credible Effects   ==================================================

 Covariate      Group[T.Ground Control | 29 Weeks] Group[T.Space Flight | 12 Weeks] Group[T.Space Flight | 29 Weeks]
Cell Type                                                                                                          
Inhibitory                                                                                                         
SnC Inhibitory                                                                   *                                 

==========================================================================================================================



• Zero counts encountered in data! Added a pseudocount of 0.5.
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
No description has been provided for this image
sample: 100%|█| 11000/11000 [39:03<00:00,  4.69it/s, 1023 steps of size 7.21e-1
                                          Compositional Analysis summary                                           
┌───────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────┐
│ Name                                  │ Value                                                                   │
├───────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Data                                  │ Data: 18 samples, 2 cell types                                          │
│ Reference cell type                   │ Microglial                                                              │
│ Formula                               │ Group                                                                   │
│ Reference index                       │ 0                                                                       │
│ Spike-and-slab threshold              │ 1.000                                                                   │
│ Spike-and-slab threshold              │ 1.000                                                                   │
│ MCMC Sampling                         │ Sampled 10000 chain states (1000 burnin samples)                        │
│ Acceptance rate                       │ 88.1%                                                                   │
└───────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Intercepts                                                                                                      │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                               Final Parameter  HDI 3%  HDI 97%   SD   Expected Sample                           │
│ Senescent_Cell_Label_by_Type                                                                                    │
│ Microglial                        32.635       32.635  32.635  0.000     213.639                                │
│ SnC Microglial                     1.613        1.613   1.613  0.000       0.000                                │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects                                                                                                         │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                                  Final Parameter  Expected Sample  log2-fold change             │
│ Covariate                        Cell Type                                                                      │
│ GroupT.Ground Control | 29 Weeks Microglial           0.000            0.000           -21.314                  │
│                                  SnC Microglial      45.796          213.639            44.755                  │
│ GroupT.Space Flight | 12 Weeks   Microglial           0.000          213.639             0.000                  │
│                                  SnC Microglial       0.000            0.000             0.000                  │
│ GroupT.Space Flight | 29 Weeks   Microglial           0.000          213.639             0.000                  │
│                                  SnC Microglial       0.000            0.000             0.000                  │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects Extended                                                                                                │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                                  HDI 3%  HDI 97%   SD   Inclusion probability                   │
│ Covariate                        Cell Type                                                                      │
│ GroupT.Ground Control | 29 Weeks Microglial       0.000   0.000  0.000         0.000                            │
│                                  SnC Microglial  45.796  45.796  0.000         1.000                            │
│ GroupT.Space Flight | 12 Weeks   Microglial       0.000   0.000  0.000         0.000                            │
│                                  SnC Microglial     NaN     NaN  0.000         0.000                            │
│ GroupT.Space Flight | 29 Weeks   Microglial       0.000   0.000  0.000         0.000                            │
│                                  SnC Microglial     NaN     NaN  0.000         0.000                            │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
... storing 'rna:Senescent_Cell_Label_senmayo' as categorical
... storing 'rna:Senescent_Cell_Label_senmayo_3' as categorical
... storing 'rna:Senescent_Cell_Label_by_Type_senmayo' as categorical
... storing 'rna:Senescent_Cell_Label' as categorical
... storing 'rna:Senescent_Cell_Label_by_Type' as categorical
... storing 'rna:scCODA_sample_id' as categorical
... storing 'Senescent_Cell_Label_senmayo' as categorical
... storing 'Senescent_Cell_Label_senmayo_3' as categorical
... storing 'Senescent_Cell_Label_by_Type_senmayo' as categorical
... storing 'Senescent_Cell_Label' as categorical
... storing 'Senescent_Cell_Label_by_Type' as categorical
... storing 'scCODA_sample_id' as categorical

==================================================   Credible Effects   ==================================================

 Covariate      Group[T.Ground Control | 29 Weeks] Group[T.Space Flight | 12 Weeks] Group[T.Space Flight | 29 Weeks]
Cell Type                                                                                                          
Microglial                                                                                                         
SnC Microglial                                  *                                                                  

==========================================================================================================================



• Zero counts encountered in data! Added a pseudocount of 0.5.
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
No description has been provided for this image
sample: 100%|█| 11000/11000 [39:54<00:00,  4.59it/s, 1023 steps of size 6.59e-1
                                          Compositional Analysis summary                                           
┌───────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────┐
│ Name                                  │ Value                                                                   │
├───────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Data                                  │ Data: 18 samples, 2 cell types                                          │
│ Reference cell type                   │ OPC                                                                     │
│ Formula                               │ Group                                                                   │
│ Reference index                       │ 0                                                                       │
│ Spike-and-slab threshold              │ 1.000                                                                   │
│ Spike-and-slab threshold              │ 1.000                                                                   │
│ MCMC Sampling                         │ Sampled 10000 chain states (1000 burnin samples)                        │
│ Acceptance rate                       │ 91.3%                                                                   │
└───────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Intercepts                                                                                                      │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                               Final Parameter  HDI 3%  HDI 97%   SD   Expected Sample                           │
│ Senescent_Cell_Label_by_Type                                                                                    │
│ OPC                               34.149       34.149  34.149  0.000     173.417                                │
│ SnC OPC                            1.289        1.289   1.289  0.000       0.000                                │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects                                                                                                         │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                             Final Parameter  Expected Sample  log2-fold change                  │
│ Covariate                        Cell Type                                                                      │
│ GroupT.Ground Control | 29 Weeks OPC             0.000            0.013           -13.712                       │
│                                  SnC OPC        42.364          173.404            47.407                       │
│ GroupT.Space Flight | 12 Weeks   OPC             0.000          173.417             0.000                       │
│                                  SnC OPC         0.000            0.000             0.000                       │
│ GroupT.Space Flight | 29 Weeks   OPC             0.000          166.647            -0.057                       │
│                                  SnC OPC        29.657            6.770            42.728                       │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects Extended                                                                                                │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                             HDI 3%  HDI 97%   SD   Inclusion probability                        │
│ Covariate                        Cell Type                                                                      │
│ GroupT.Ground Control | 29 Weeks OPC         0.000   0.000  0.000         0.000                                 │
│                                  SnC OPC    42.364  42.364  0.000         1.000                                 │
│ GroupT.Space Flight | 12 Weeks   OPC         0.000   0.000  0.000         0.000                                 │
│                                  SnC OPC       NaN     NaN  0.000         0.000                                 │
│ GroupT.Space Flight | 29 Weeks   OPC         0.000   0.000  0.000         0.000                                 │
│                                  SnC OPC    29.657  29.657  0.000         1.000                                 │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
... storing 'rna:Senescent_Cell_Label_senmayo' as categorical
... storing 'rna:Senescent_Cell_Label_senmayo_3' as categorical
... storing 'rna:Senescent_Cell_Label_by_Type_senmayo' as categorical
... storing 'rna:Senescent_Cell_Label' as categorical
... storing 'rna:Senescent_Cell_Label_by_Type' as categorical
... storing 'rna:scCODA_sample_id' as categorical
... storing 'Senescent_Cell_Label_senmayo' as categorical
... storing 'Senescent_Cell_Label_senmayo_3' as categorical
... storing 'Senescent_Cell_Label_by_Type_senmayo' as categorical
... storing 'Senescent_Cell_Label' as categorical
... storing 'Senescent_Cell_Label_by_Type' as categorical
... storing 'scCODA_sample_id' as categorical

==================================================   Credible Effects   ==================================================

 Covariate Group[T.Ground Control | 29 Weeks] Group[T.Space Flight | 12 Weeks] Group[T.Space Flight | 29 Weeks]
Cell Type                                                                                                     
OPC                                                                                                           
SnC OPC                                    *                                                                 *

==========================================================================================================================



• Zero counts encountered in data! Added a pseudocount of 0.5.
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
No description has been provided for this image
sample: 100%|█| 11000/11000 [00:45<00:00, 239.95it/s, 1 steps of size 6.86e-02.
! Acceptance rate unusually low (0.061323104336006136 < 0.5)! Results might be incorrect! Please check feasibility of results and re-run the sampling step with a different rng_key if necessary.

                                          Compositional Analysis summary                                           
┌───────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────┐
│ Name                                  │ Value                                                                   │
├───────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────┤
│ Data                                  │ Data: 18 samples, 2 cell types                                          │
│ Reference cell type                   │ Astrocyte                                                               │
│ Formula                               │ Group                                                                   │
│ Reference index                       │ 0                                                                       │
│ Spike-and-slab threshold              │ 0.952                                                                   │
│ Spike-and-slab threshold              │ 0.952                                                                   │
│ MCMC Sampling                         │ Sampled 10000 chain states (1000 burnin samples)                        │
│ Acceptance rate                       │ 6.1%                                                                    │
└───────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Intercepts                                                                                                      │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                               Final Parameter  HDI 3%  HDI 97%   SD    Expected Sample                          │
│ Senescent_Cell_Label_by_Type                                                                                    │
│ Astrocyte                         32.481        4.565  42.691  16.743     453.806                               │
│ SnC Astrocyte                     -0.299       -0.633   0.539   0.406       0.000                               │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects                                                                                                         │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                                 Final Parameter  Expected Sample  log2-fold change              │
│ Covariate                        Cell Type                                                                      │
│ GroupT.Ground Control | 29 Weeks Astrocyte           0.000            0.000           -187.327                  │
│                                  SnC Astrocyte     162.625          453.806             47.292                  │
│ GroupT.Space Flight | 12 Weeks   Astrocyte           0.000          453.806              0.000                  │
│                                  SnC Astrocyte       0.000            0.000              0.000                  │
│ GroupT.Space Flight | 29 Weeks   Astrocyte           0.000            0.000            -38.897                  │
│                                  SnC Astrocyte      59.741          453.806             47.292                  │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Effects Extended                                                                                                │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│                                                 HDI 3%  HDI 97%   SD    Inclusion probability                   │
│ Covariate                        Cell Type                                                                      │
│ GroupT.Ground Control | 29 Weeks Astrocyte       0.000   0.000   0.000         0.000                            │
│                                  SnC Astrocyte  40.134 242.308  76.373         0.952                            │
│ GroupT.Space Flight | 12 Weeks   Astrocyte       0.000   0.000   0.000         0.000                            │
│                                  SnC Astrocyte  -1.167   0.249   0.114         0.043                            │
│ GroupT.Space Flight | 29 Weeks   Astrocyte       0.000   0.000   0.000         0.000                            │
│                                  SnC Astrocyte   1.583  94.959  35.984         0.975                            │
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
... storing 'rna:Senescent_Cell_Label_senmayo' as categorical
... storing 'rna:Senescent_Cell_Label_senmayo_3' as categorical
... storing 'rna:Senescent_Cell_Label_by_Type_senmayo' as categorical
... storing 'rna:Senescent_Cell_Label' as categorical
... storing 'rna:Senescent_Cell_Label_by_Type' as categorical
... storing 'rna:scCODA_sample_id' as categorical
... storing 'Senescent_Cell_Label_senmayo' as categorical
... storing 'Senescent_Cell_Label_senmayo_3' as categorical
... storing 'Senescent_Cell_Label_by_Type_senmayo' as categorical
... storing 'Senescent_Cell_Label' as categorical
... storing 'Senescent_Cell_Label_by_Type' as categorical
... storing 'scCODA_sample_id' as categorical

==================================================   Credible Effects   ==================================================

 Covariate     Group[T.Ground Control | 29 Weeks] Group[T.Space Flight | 12 Weeks] Group[T.Space Flight | 29 Weeks]
Cell Type                                                                                                         
Astrocyte                                                                                                         
SnC Astrocyte                                  *                                                                 *

==========================================================================================================================



SnCs (Ignore Age)¶

In [ ]:
print(f"\n\n{'=' * 80}\nBy Cell Type\n{'=' * 80}\n\n")
out_ctc_ct_ageag = {}
for x in self.rna.obs[col_celltype].unique():
    out_ctc_ct_ageag[x] = scflow.ax.analyze_composition(
        self.rna[self.rna.obs[col_celltype] == x],
        "Senescent_Cell_Label_by_Type", col_condition, col_sample=col_sample,
        palette=palette[col_condition],
        reference_cell_type=x, absence_threshold=0.1, est_fdr=0.1,
        level_order=[keys[col_batch]["key_control"]] + keys[
            col_batch]["key_treatment"])
    plt.show()

Differential Gene Expression¶

Mainly using edgeR

Age¶

In older spaceflight mice compared to younger spaceflight mice

  • 9630013a20Rik (CNS myelination and neural tissue regeneration) is downregulated.
  • mt-Td is upregulated.
In [29]:
%matplotlib inline

# Overall
print(f"\n\n{'=' * 80}\nOverall Sample\n{'=' * 80}\n\n")
out_edgr_age = scflow.ax.run_deg_edgr(
    self.rna, col_age, col_covariate=None, formula=None,
    **keys[col_age], log2fc_thresh=0, n_top_vars=25,
    col_celltype=col_celltype, col_sample=col_sample,
    fig_title="Age DEGs: Overall Sample\n\n")

# Ground Control Subset
print(f"\n\n{'=' * 80}\nGround Control Subset\n{'=' * 80}\n\n")
out_edgr_age_gc = scflow.ax.run_deg_edgr(
    self.rna[self.rna.obs[col_condition] == keys[
        col_condition]["key_control"]],
    col_age, col_covariate=None, formula=None,
    **keys[col_age], log2fc_thresh=0, n_top_vars=25,
    col_celltype=col_celltype, col_sample=col_sample,
    fig_title="Age DEGs: Just Ground Control\n\n")

# Space Flight Subset
print(f"\n\n{'=' * 80}\nSpace Flight Subset\n{'=' * 80}\n\n")
out_edgr_age_sf = scflow.ax.run_deg_edgr(
    self.rna[self.rna.obs[col_condition] == keys[
        col_condition]["key_treatment"]],
    col_age, col_covariate=None, formula=None, **keys[col_age],
    log2fc_thresh=0, n_top_vars=25, col_celltype=col_celltype,
    col_sample=col_sample, fig_title="Age DEGs: Just Space Flight\n\n")

================================================================================
Overall Sample
================================================================================


• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model


================================================================================
Ground Control Subset
================================================================================


• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model


================================================================================
Space Flight Subset
================================================================================


• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image

Condition¶

out_edgr_con_o[0][(out_edgr_con_o[0].adj_p_value < 0.01) & (
    out_edgr_con_o[0].abs_log_fc > 0.5)].sort_values(
        "abs_log_fc", ascending=False)

Among the older mice, Mir6236 was differentially highly expressed in aged spaceflight mice compared to ground control mice (LFC=1.95, adjusted p=2.61e-13 in the overall sample; LFC=2.11, adjusted p=0.000015 in the aged subset). Suppression of this gene has been linked to neuronal morphogenesis (https://pubs.acs.org/doi/abs/10.1021/acsabm.0c01389) and therefore may represent a candidate intervention target.

Il31ra, which has been linked to neuroinflammation (https://advanced.onlinelibrary.wiley.com/doi/pdfdirect/10.1002/advs.202409086), was also more highly expressed in spaceflight mice compared to ground control mice (LFC=1.52, adjusted p<0.001 in the overall sample; LFC=1.53, adjusted p<0.001 in the aged subset).

UBA52, also more highly expressed in spaceflight mice (LFC=1.43, adjusted p<0.001 in the overall sample; LFC=1.45, adjusted p<0.001 in the aged subset), may serve a neuroprotective role: It has been shown underexpressed in PD (https://www.mdpi.com/2073-4409/11/23/3770) and plays a role in neuroautophagy (https://www.tandfonline.com/doi/pdf/10.1080/15548627.2024.2395727). Likewise, Pomp, a gene associated with oxidative stress resistance and protein clearance [CITATION] was also more highly expressed in spaceflight mice. In contrast to past observations of downregulation of Uqcr11 in Alheimer's (https://www.benthamdirect.com/content/journals/car/10.2174/1567205014666170505095921), that gene was differentially highly expressed in spaceflight mice (LFC=1.23 aged subset; LFC=1.44 overall; p<0.001); however, Cmss1, which has been associated with Alzheimer's in APOE4 mice (https://pmc.ncbi.nlm.nih.gov/articles/PMC8064208/), was also more highly expressed in spaceflight mice.

Genes involved in oxidative phosphorylation and the electron transport chain, including Atp5e, Ndufa12, and Uqcr11 were also more highly expressed in spaceflight mice. Uqcr11 has shown an anti-apoptotic and oxidative stress alleviation role in mice (https://www.mdpi.com/2073-4425/16/5/526).

Tpt1 and Rn7sk were also upregulated in spaceflight mice. Tpt1, which is associated with cancer progression, anti-apoptosis, and cell stress response, has been shown to have a potentially bi-directional relationship with cell cycle control gene and canonical senescence marker TP53 (https://www.tandfonline.com/doi/pdf/10.4161/cc.25404). Rn7sk is associated with cellular senescence (https://onlinelibrary.wiley.com/doi/abs/10.1002/jcp.28119) and Alzheimer's (https://www.nature.com/articles/s41598-024-82490-9.pdf).


Pvalb overall sample (LFC=1.61, p=1.25e-11)

Trim17

Cck

Pam16


Mitochondrial/electron transport chain genes whose upregulation has been linked to Parkinson's disease (https://pmc.ncbi.nlm.nih.gov/articles/PMC10259399/pdf/AMS-19-3-131629.pdf) and/or adaptive responses to neurodegeneration in Alheimer's mouse models (https://journals.sagepub.com/doi/abs/10.1177/13872877251314847), including *mt-Atp6, mt-Co1, mt-Cytb mt-Nd2, and mt-Nd5, mt-Nd6...pregulation of *mt-Rnr1, which also showed higher expression in spaceflight aged mice, has been seen in response to ionizing radiation, possibly reflecting increased mitochonrial biogenesis as an adaptive stress response (https://pmc.ncbi.nlm.nih.gov/articles/PMC5555881)**

In [31]:
%matplotlib inline

# Overall
print(f"\n\n{'=' * 80}\nOverall Sample\n{'=' * 80}\n\n")
out_edgr_con = scflow.ax.run_deg_edgr(
    self.rna, col_condition, col_covariate=None, formula=None,
    **keys[col_condition], log2fc_thresh=0, n_top_vars=25,
    col_celltype=col_celltype, col_sample=col_sample,
    fig_title=f"{col_condition} DEGs (Overall Sample)\n\n")
out_edgr_con_df = out_edgr_con[0][out_edgr_con[
    0].adj_p_value < 0.001].sort_values("abs_log_fc", ascending=False)
goe = out_edgr_con_df.variable[:10].to_list()
print(out_edgr_con_df.iloc[:min(100, out_edgr_con_df.shape[0])], "\n\n", goe)
plt.show()

# Just Old
print(f"\n\n{'=' * 80}\nAged Subset\n{'=' * 80}\n\n")
out_edgr_con_o = scflow.ax.run_deg_edgr(
    self.rna[self.rna.obs[col_age] == keys[col_age]["key_treatment"]],
    col_condition, col_covariate=None, formula=None,
    **keys[col_condition], log2fc_thresh=0, n_top_vars=25,
    col_celltype=col_celltype, col_sample=col_sample,
    fig_title=f"{col_condition} DEGs (Just Aged)\n\n")
plt.show()
out_edgr_con_o_df = out_edgr_con_o[0][out_edgr_con_o[
    0].adj_p_value < 0.001].sort_values("abs_log_fc", ascending=False)
goes = out_edgr_con_o_df.variable[:10].to_list()
print(out_edgr_con_o_df, "\n\n", goes)
_ = self.plot(
    kind=["violin", "matrix"], col_celltype=col_batch, layer="log1p",
    violin=dict(col_wrap=5, hspace=0.25, rotation=45, figsize=(20, 20)),
    matrix=dict(standard_scale="var"), genes=goes)
out_edgr_old_sf_v_gc = out_edgr_con_o_df[0][(
    out_edgr_con_o_df[0].abs_log_fc > 1) & (
        out_edgr_con_o_df[0].adj_p_value < 0.001)].sort_values(
            "adj_p_value", ascending=True)
out_edgr_old_sf_v_gc = out_edgr_old_sf_v_gc.groupby("contrast").apply(
    lambda x: x.sort_values("adj_p_value", ascending=True).iloc[
        :20]).set_index("variable", append=True).reset_index(
            1, drop=True).rename_axis([col_condition, "variable"])
out_edgr_con_compare = out_edgr_con_o_df.set_index("variable")[[
    "log_fc", "adj_p_value"]].join(out_edgr_con_df.set_index("variable")[[
        "log_fc", "adj_p_value"]], how="inner", lsuffix="_Aged_Subset",
                                   rsuffix="_Overall_Sample")
out_edgr_con_compare

================================================================================
Overall Sample
================================================================================


• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
     variable    log_fc    logCPM           F       p_value   adj_p_value      contrast  abs_log_fc significance
44    Mir6236  1.949094  8.159038   84.435148  9.711715e-16  2.610725e-13  Space Flight    1.949094      < 0.001
164   Gm48099  1.780488  2.819978   53.266077  1.135266e-11  8.323221e-10  Space Flight    1.780488      < 0.001
130   Gm10076  1.757596  3.404199   59.692926  1.379155e-12  1.273560e-10  Space Flight    1.757596      < 0.001
227   Gm28438  1.678793  5.879479   45.438617  4.617519e-10  2.442226e-08  Space Flight    1.678793      < 0.001
166     Pvalb  1.605108  3.555032   53.957324  1.248318e-11  9.042458e-10  Space Flight    1.605108      < 0.001
6       Atp5e  1.539489  5.428601  117.228802  6.211831e-20  1.073493e-16  Space Flight    1.539489      < 0.001
281   Gm15501  1.537294  1.927398   38.802593  2.979110e-09  1.277954e-07  Space Flight    1.537294      < 0.001
145    Il31ra  1.524226  3.882197   57.257208  4.242210e-12  3.514933e-10  Space Flight    1.524226      < 0.001
278     Gstm5  1.500663  5.850129   41.013165  2.528153e-09  1.096167e-07  Space Flight    1.500663      < 0.001
26     Ndufa1  1.496731  5.073037   95.571980  2.368904e-17  1.058347e-14  Space Flight    1.496731      < 0.001
123      H4c4  1.491993  3.142018   60.776879  8.564019e-13  8.354753e-11  Space Flight    1.491993      < 0.001
7      Uqcr11  1.439361  5.602019  113.035340  2.053137e-19  2.813212e-16  Space Flight    1.439361      < 0.001
29      Uba52  1.428775  4.375851   93.650312  3.198489e-17  1.289738e-14  Space Flight    1.428775      < 0.001
331      Nefh  1.420208  3.309907   34.970474  2.122765e-08  7.734666e-07  Space Flight    1.420208      < 0.001
2      Ndufa4  1.415833  6.724382  126.260441  8.310331e-21  2.841834e-17  Space Flight    1.415833      < 0.001
15     Ndufc1  1.400395  4.990762  106.655939  9.620240e-19  7.273503e-16  Space Flight    1.400395      < 0.001
32      Cox5b  1.397197  6.090833   92.758984  7.015765e-17  2.571809e-14  Space Flight    1.397197      < 0.001
40        Fau  1.383165  6.883136   87.074704  4.178684e-16  1.232916e-13  Space Flight    1.383165      < 0.001
27       Tpt1  1.380907  6.932382   96.630905  2.528130e-17  1.058347e-14  Space Flight    1.380907      < 0.001
161      Pcp4  1.373495  6.702704   55.886023  1.068908e-11  7.981840e-10  Space Flight    1.373495      < 0.001
31    Ndufa13  1.371411  6.366018   92.989430  6.845693e-17  2.571809e-14  Space Flight    1.371411      < 0.001
4      Chchd2  1.362659  6.416984  124.713259  1.174603e-20  2.841834e-17  Space Flight    1.362659      < 0.001
1      Cox7a2  1.353486  6.080846  129.861276  2.954247e-21  1.786876e-17  Space Flight    1.353486      < 0.001
124     Gng13  1.348863  3.651035   61.246960  9.352578e-13  9.051051e-11  Space Flight    1.348863      < 0.001
548     Gstp1  1.344087  3.783787   23.594716  3.062461e-06  6.748013e-05  Space Flight    1.344087      < 0.001
648    Lrrc17  1.331544  2.331744   19.556140  1.720262e-05  3.206473e-04  Space Flight    1.331544      < 0.001
0     Atp5o-1  1.320518  5.595098  131.410251  1.720159e-21  1.786876e-17  Space Flight    1.320518      < 0.001
16      Uqcc2  1.319373  5.034415  106.496327  1.028665e-18  7.319858e-16  Space Flight    1.319373      < 0.001
372    Sdf2l1  1.302962  3.365520   31.683687  8.666740e-08  2.810766e-06  Space Flight    1.302962      < 0.001
22       Ubl5  1.301766  5.235191  101.320761  4.798861e-18  2.523992e-15  Space Flight    1.301766      < 0.001
37     Ndufb7  1.299214  5.226608   89.517411  1.528970e-16  4.790564e-14  Space Flight    1.299214      < 0.001
147      Gpx4  1.298226  5.108516   57.963713  4.411832e-12  3.606076e-10  Space Flight    1.298226      < 0.001
66    Chchd10  1.297640  6.162569   77.841234  6.708275e-15  1.207599e-12  Space Flight    1.297640      < 0.001
33     Ndufb8  1.294489  5.740803   91.829891  8.687932e-17  3.091115e-14  Space Flight    1.294489      < 0.001
52     Ndufs6  1.294290  4.782131   79.735685  2.779925e-15  6.345047e-13  Space Flight    1.294290      < 0.001
13      Uqcrb  1.286523  5.421231  107.852624  8.112226e-19  7.009542e-16  Space Flight    1.286523      < 0.001
288   Gm19951  1.284459  3.149592   39.066613  3.808010e-09  1.593962e-07  Space Flight    1.284459      < 0.001
61    Ndufb11  1.282625  5.510742   78.452429  4.994030e-15  9.602235e-13  Space Flight    1.282625      < 0.001
18      Cox6c  1.282000  6.723627  104.290588  2.851979e-18  1.687364e-15  Space Flight    1.282000      < 0.001
78    Micos13  1.277313  4.594700   72.835243  2.461198e-14  3.768748e-12  Space Flight    1.277313      < 0.001
202      Bbln  1.277230  4.786272   50.254260  6.861508e-11  4.088850e-09  Space Flight    1.277230      < 0.001
34    Tmem160  1.274164  4.172001   89.562878  1.011213e-16  3.495042e-14  Space Flight    1.274164      < 0.001
232       Cck  1.268391  6.751274   45.519797  4.713299e-10  2.447072e-08  Space Flight    1.268391      < 0.001
19     Cox4i1  1.264139  7.466084  104.500190  2.853605e-18  1.687364e-15  Space Flight    1.264139      < 0.001
122   Wdr83os  1.262206  4.001804   61.894153  8.549852e-13  8.354753e-11  Space Flight    1.262206      < 0.001
55     Ndufc2  1.256252  6.139897   79.923690  3.483138e-15  7.524201e-13  Space Flight    1.256252      < 0.001
39      Atp5h  1.254027  6.292460   87.525309  3.453531e-16  1.044434e-13  Space Flight    1.254027      < 0.001
70      Atp5k  1.252296  5.566543   76.009661  1.100038e-14  1.874248e-12  Space Flight    1.252296      < 0.001
102    Tmsb10  1.250417  5.289951   67.662558  1.612022e-13  1.893265e-11  Space Flight    1.250417      < 0.001
38      Pam16  1.250255  4.579989   88.792139  1.544449e-16  4.790564e-14  Space Flight    1.250255      < 0.001
57     Prxl2b  1.247075  3.415394   76.836014  3.824583e-15  7.976893e-13  Space Flight    1.247075      < 0.001
41    Ndufa11  1.244165  5.573681   86.278694  4.457879e-16  1.283975e-13  Space Flight    1.244165      < 0.001
10     Cox6b1  1.242030  6.240567  112.087763  3.150641e-19  3.464845e-16  Space Flight    1.242030      < 0.001
246     Ttc9b  1.237726  4.273295   43.356159  8.735269e-10  4.278160e-08  Space Flight    1.237726      < 0.001
25      Atp5j  1.237422  6.226298   97.530849  1.806729e-17  8.406153e-15  Space Flight    1.237422      < 0.001
30      Cox8a  1.236015  7.200296   94.334628  5.019285e-17  1.958654e-14  Space Flight    1.236015      < 0.001
5      Ndufa8  1.229698  4.908171  117.526732  4.752101e-20  9.581028e-17  Space Flight    1.229698      < 0.001
56   Map1lc3a  1.227905  5.124941   79.209854  3.615474e-15  7.673051e-13  Space Flight    1.227905      < 0.001
9      Atp5g1  1.220064  5.806668  112.290161  2.710636e-19  3.279056e-16  Space Flight    1.220064      < 0.001
62      Cops9  1.216710  4.914995   78.024198  5.000751e-15  9.602235e-13  Space Flight    1.216710      < 0.001
224     Serf1  1.214591  2.496361   44.853315  3.031486e-10  1.629862e-08  Space Flight    1.214591      < 0.001
110     Mien1  1.209610  3.837071   64.964475  2.749663e-13  2.996638e-11  Space Flight    1.209610      < 0.001
36      Hspa8  1.206068  7.295758   90.586066  1.512053e-16  4.790564e-14  Space Flight    1.206068      < 0.001
20     Ndufb5  1.191308  5.680552  103.546784  2.929209e-18  1.687364e-15  Space Flight    1.191308      < 0.001
179    Gm1673  1.178829  4.935595   52.881251  2.676364e-11  1.798665e-09  Space Flight    1.178829      < 0.001
50       Elob  1.174507  5.983606   81.362900  2.184402e-15  5.124952e-13  Space Flight    1.174507      < 0.001
308      Nefm  1.174402  4.795635   37.438837  9.630419e-09  3.770200e-07  Space Flight    1.174402      < 0.001
63    Atp5mpl  1.173997  5.394527   77.937550  5.772956e-15  1.091179e-12  Space Flight    1.173997      < 0.001
24      Tomm7  1.172246  4.844955   97.409397  1.305090e-17  6.315071e-15  Space Flight    1.172246      < 0.001
455       Mt3  1.165726  7.185270   28.152804  4.814190e-07  1.276576e-05  Space Flight    1.165726      < 0.001
54     Ndufa2  1.163015  5.189443   79.570776  3.288112e-15  7.232052e-13  Space Flight    1.163015      < 0.001
525      Fth1  1.160861  8.840357   24.919214  1.933093e-06  4.445747e-05  Space Flight    1.160861      < 0.001
84      Romo1  1.156770  4.675525   72.145065  3.175450e-14  4.519225e-12  Space Flight    1.156770      < 0.001
136       Ubb  1.153242  7.196739   60.310964  2.329261e-12  2.056720e-10  Space Flight    1.153242      < 0.001
160     Bola2  1.149047  3.977584   54.947285  1.037850e-11  7.798058e-10  Space Flight    1.149047      < 0.001
86     Ndufb9  1.147914  5.829289   71.887560  4.363798e-14  6.067685e-12  Space Flight    1.147914      < 0.001
87     Snrpd2  1.145719  4.376915   70.847898  4.482610e-14  6.162061e-12  Space Flight    1.145719      < 0.001
47     Ndufa5  1.145661  5.497964   81.642095  1.840363e-15  4.638097e-13  Space Flight    1.145661      < 0.001
51      Uqcrq  1.145056  5.980211   81.338436  2.203005e-15  5.124952e-13  Space Flight    1.145056      < 0.001
49        Mif  1.143343  5.730586   81.248177  2.176483e-15  5.124952e-13  Space Flight    1.143343      < 0.001
268     Fabp3  1.143316  4.012521   41.212189  1.942679e-09  8.719205e-08  Space Flight    1.143316      < 0.001
263   Krtcap2  1.142985  5.143977   41.899200  1.712171e-09  7.845504e-08  Space Flight    1.142985      < 0.001
11      Cox7c  1.141101  6.771296  110.892853  4.721206e-19  4.759369e-16  Space Flight    1.141101      < 0.001
103    Uqcr10  1.140867  5.384021   67.602655  1.678991e-13  1.952957e-11  Space Flight    1.140867      < 0.001
421    Tmsb4x  1.140484  7.962665   29.616623  2.614201e-07  7.493837e-06  Space Flight    1.140484      < 0.001
194    Ndufs8  1.137055  4.819290   51.065449  5.125605e-11  3.179715e-09  Space Flight    1.137055      < 0.001
76     Ndufb6  1.130561  4.639037   73.241935  2.191407e-14  3.442786e-12  Space Flight    1.130561      < 0.001
74     Eef1b2  1.125756  5.458095   74.579041  1.717882e-14  2.738844e-12  Space Flight    1.125756      < 0.001
71       Cycs  1.124288  4.807677   75.031384  1.278788e-14  2.148541e-12  Space Flight    1.124288      < 0.001
28      Cox5a  1.121024  6.065679   96.279598  2.537163e-17  1.058347e-14  Space Flight    1.121024      < 0.001
23    Slc25a4  1.120911  7.072543  100.334401  8.957301e-18  4.514853e-15  Space Flight    1.120911      < 0.001
138   Tmem14c  1.120603  4.301852   58.941460  2.677887e-12  2.330533e-10  Space Flight    1.120603      < 0.001
336   Gm11478  1.120210  3.535431   34.628592  2.595719e-08  9.317629e-07  Space Flight    1.120210      < 0.001
21    Atp6v1f  1.120100  5.227498  102.375439  3.587833e-18  1.972819e-15  Space Flight    1.120100      < 0.001
557   Gm37194  1.120087  1.909968   22.649994  3.917522e-06  8.492879e-05  Space Flight    1.120087      < 0.001
53      Pfdn5  1.119967  5.493524   79.889945  3.186945e-15  7.139346e-13  Space Flight    1.119967      < 0.001
83     Atp5md  1.119763  6.120894   73.169508  2.986562e-14  4.301005e-12  Space Flight    1.119763      < 0.001
96     Timm8b  1.118199  4.710934   68.676082  1.020067e-13  1.272139e-11  Space Flight    1.118199      < 0.001
158    Ndufa3  1.115852  5.571474   56.292932  8.532050e-12  6.491334e-10  Space Flight    1.115852      < 0.001
94   Hsp90ab1  1.115624  8.086405   70.009669  9.175544e-14  1.164740e-11  Space Flight    1.115624      < 0.001 

 ['Mir6236', 'Gm48099', 'Gm10076', 'Gm28438', 'Pvalb', 'Atp5e', 'Gm15501', 'Il31ra', 'Gstm5', 'Ndufa1']
No description has been provided for this image

================================================================================
Aged Subset
================================================================================


• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
No description has been provided for this image
... storing 'Senescent_Cell_Label_senmayo' as categorical
... storing 'Senescent_Cell_Label_by_Type_senmayo' as categorical
... storing 'Senescent_Cell_Label' as categorical
... storing 'Senescent_Cell_Label_by_Type' as categorical
   variable    log_fc    logCPM          F       p_value  adj_p_value      contrast  abs_log_fc significance
0   Mir6236  2.063029  8.363280  46.492220  4.055211e-09     0.000049  Space Flight    2.063029      < 0.001
10   Il31ra  1.530428  4.129139  29.232213  7.627201e-07     0.000783  Space Flight    1.530428      < 0.001
1      H4c4  1.511849  3.253100  34.712152  8.279252e-08     0.000274  Space Flight    1.511849      < 0.001
4     Uba52  1.450167  4.645899  32.934334  2.208072e-07     0.000534  Space Flight    1.450167      < 0.001
3     Atp5e  1.242101  5.648002  36.015202  9.050973e-08     0.000274  Space Flight    1.242101      < 0.001
5    Uqcr11  1.237704  5.779053  32.530978  2.989400e-07     0.000603  Space Flight    1.237704      < 0.001
7      Tpt1  1.129632  7.072873  31.454011  4.715708e-07     0.000713  Space Flight    1.129632      < 0.001
9     Cox6c  1.107987  6.893087  30.186732  7.277902e-07     0.000783  Space Flight    1.107987      < 0.001
2     Cmss1  1.052344  8.364766  36.606510  8.653564e-08     0.000274  Space Flight    1.052344      < 0.001
14    Rn7sk  1.045513  7.093615  28.928569  1.142235e-06     0.000921  Space Flight    1.045513      < 0.001
13    Tomm7  1.024909  5.002519  28.859654  1.003420e-06     0.000867  Space Flight    1.024909      < 0.001
6     Lars2  1.013987  7.418589  32.248250  3.630910e-07     0.000627  Space Flight    1.013987      < 0.001
11  Atp5o-1  0.973723  5.687560  29.721979  7.961999e-07     0.000783  Space Flight    0.973723      < 0.001
8      Pomp  0.803001  5.170618  30.690752  5.337545e-07     0.000717  Space Flight    0.803001      < 0.001
12  Ndufa12  0.784367  5.462573  29.512997  8.409691e-07     0.000783  Space Flight    0.784367      < 0.001 

 ['Mir6236', 'Il31ra', 'H4c4', 'Uba52', 'Atp5e', 'Uqcr11', 'Tpt1', 'Cox6c', 'Cmss1', 'Rn7sk']
None
No description has been provided for this image
No description has been provided for this image
Out[31]:
log_fc_Aged_Subset adj_p_value_Aged_Subset log_fc_Overall_Sample adj_p_value_Overall_Sample
variable
Mir6236 2.063029 0.000049 1.949094 2.610725e-13
Il31ra 1.530428 0.000783 1.524226 3.514933e-10
H4c4 1.511849 0.000274 1.491993 8.354753e-11
Uba52 1.450167 0.000534 1.428775 1.289738e-14
Atp5e 1.242101 0.000274 1.539489 1.073493e-16
Uqcr11 1.237704 0.000603 1.439361 2.813212e-16
Tpt1 1.129632 0.000713 1.380907 1.058347e-14
Cox6c 1.107987 0.000783 1.282000 1.687364e-15
Cmss1 1.052344 0.000274 0.992381 3.212392e-11
Rn7sk 1.045513 0.000921 0.826958 1.212908e-06
Tomm7 1.024909 0.000867 1.172246 6.315071e-15
Lars2 1.013987 0.000627 0.846444 1.512236e-10
Atp5o-1 0.973723 0.000783 1.320518 1.786876e-17
Pomp 0.803001 0.000717 0.985319 4.831120e-16
Ndufa12 0.784367 0.000783 0.981876 2.841834e-17

Age x Condition¶

Spaceflight effect (main analysis), can visualize at different ages

Chchd2 (related to oxidative phosphorylation, cell migration, apoptosis inhibition, COX regulation, stress adaptation, Parkinson's, Lewy Body diseases, and cancer) was more highly expressed in spaceflight mice (and demonstrated a bigger young versus old difference in spaceflight mice). Spaceflight mice also showed higher expression of several ribosomal proteins (Rps16, Rpl31, Rpl17, Rpl9, Rpl15, Rps15a, Rpl19, Rps7, Rps23, Rpl37, Rps3a1, Rpl29, Rps15, Rps14).

Ndufa4 was also more highly expressed (implicated in cancer and mitochondrial dysfunction, part of the cytochrome c oxidase complex which drives oxidative phosphorylation, adaptation to hypoxia via downregulation of oxygen consumption and suppression of mitochondrial ROS production https://www.cell.com/cell-metabolism/fulltext/S1550-4131(11)00394-9?mobileUi=0) in spaceflight mice, as were other genes involved in ATP production/the electron transport chain and oxidative phosophorylation, including Cox7a2, Uqcr11, Ndufa12, Ndufa4, Ndufc1, Atp5o-1, Atp5e, and Uqcrh (which additionally has been implicated in tumor suppression https://aacrjournals.org/cancerres/article/80/16_Supplement/4795/643367).

In [61]:
# With Single Label for Age x Condition
print(f"\n\n{'=' * 80}\nGroup (Single Factor)\n{'=' * 80}\n\n")
out_edgr_groups = scflow.ax.run_deg_edgr(
    self.rna, col_batch, col_covariate=None, formula=None,
    **keys[col_batch], col_sample=col_sample,
    log2fc_thresh=0, n_top_vars=25, col_celltype=col_celltype)
print(list(out_edgr_groups[0].variable[:25]))
plt.show()
# _ = self.plot(kind="violin", col_celltype=col_batch,
#               genes=list(out_edgr_groups[0].variable[:25]), layer="scaled",
#               violin=dict(col_wrap=4, hspace=1, rotation=45))
out_edgr_batches = out_edgr_groups[0][(out_edgr_groups[0].abs_log_fc > 1) & (
    out_edgr_groups[0].adj_p_value < 0.001)].sort_values(
        "adj_p_value", ascending=True)
out_edgr_batches_top = out_edgr_batches.groupby("contrast").apply(
    lambda x: x.sort_values("adj_p_value", ascending=True).iloc[
        :20]).set_index("variable", append=True).reset_index(
            1, drop=True).rename_axis([col_condition, "variable"])

# With Contrasts (Age & Condition = Separate Factors)
print(f"\n\n{'=' * 80}\nAge * Condition (2-Factor Contrast)\n{'=' * 80}\n\n")
out_edgr_contrasts = scflow.ax.run_deg_edgr(
    self.rna, col_condition, col_covariate=col_age, formula=None,
    **keys[col_condition], log2fc_thresh=0, n_top_vars=24,
    col_celltype=col_celltype, col_sample=col_sample)
_ = self.plot(
    kind=["violin", "matrix"], col_celltype=col_batch,
    genes=out_edgr_contrasts[0][out_edgr_contrasts[
        0].adj_p_value < 0.001].sort_values(
            "abs_log_fc", ascending=False).variable[:10], layer="log1p",
    violin=dict(col_wrap=5, hspace=0.25, rotation=45, figsize=(20, 20)),
    matrix=dict(standard_scale="var"))

================================================================================
Group (Single Factor)
================================================================================


• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
['Ndufs8', 'Taco1', 'Uqcrb', 'Atp5e', 'Spcs1', 'Ubqln2', 'Snrpd2', 'Stk35', 'Psenen', 'Ndufa4', 'Mif', 'Tmsb10', 'AY036118', 'Atp6v0c', 'Chchd10', 'Cox7c', 'Ndufa13', 'Hsp90ab1', 'Ndufb11', 'Ddost', 'Ubb', 'Sco2', 'Bet1l', 'Atp5o-1', 'Ndufb10']
No description has been provided for this image

================================================================================
Age * Condition (2-Factor Contrast)
================================================================================


• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Performing pseudobulk for paired samples
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
None
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image
No description has been provided for this image

Condition x Age¶

Vulnerability of mice who were older at launch to spaceflight stress

In [36]:
# With Contrasts (Age & Condition = Separate Factors)
out_edgr_contrasts_age = scflow.ax.run_deg_edgr(
    self.rna, col_age, col_covariate=col_condition, formula=None,
    **keys[col_age], log2fc_thresh=0, n_top_vars=24,
    col_celltype=col_celltype, col_sample=col_sample)
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Performing pseudobulk for paired samples
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
No description has been provided for this image
No description has been provided for this image

Senescence Gene Contrasts Results¶

In [37]:
# Genes
sen_genes_in_contrasts = list(set(genes).intersection(
    out_edgr_contrasts[0].variable.unique()))  # senescence genes in contrasts
out_edgr_snc = out_edgr_contrasts[0].set_index(
    "variable").loc[sen_genes_in_contrasts]  # contrast results for snc genes
res_snc_contrast = out_edgr_snc[out_edgr_snc.adj_p_value < 0.01]  # p < 0.01
sig_contrast_genes = list(res_snc_contrast.index.values)  # significant genes

# Plots By Groups; Axis by Cell Types
kws = dict(dot=dict(figsize=(10, 5)), heat=dict(figsize=(15, 15)))
_ = self.plot(kind=["heat", "dot"], genes=sig_contrast_genes,
              standard_scale="obs", col_celltype=col_celltype,
              by_group=col_batch, **kws)

# Plots By Cell Types; Axis by Groups
# kws = dict(dot=dict(figsize=(10, 5)), heat=dict(figsize=(15, 15)),
#            violin=dict(figsize=(30, 20), col_wrap=4, xlabel=None,
#                        rotation=45, hspace=1, top=0.95))
kws = dict(dot=dict(figsize=(10, 5)), heat=dict(figsize=(15, 15)))
_ = self.plot(kind=["heat", "dot"], genes=sig_contrast_genes,
              standard_scale="obs", col_celltype=col_batch,
              by_group=col_celltype, **kws)

# Results
print(f"\n{'=' * 80}\nSignificant Senescence Gene Contrasts\n{'=' * 80}\n")
print(sig_contrast_genes)
res_snc_contrast
No description has been provided for this image
WARNING: Unknown type for standard_scale, ignored
No description has been provided for this image
No description has been provided for this image
WARNING: Unknown type for standard_scale, ignored
No description has been provided for this image
No description has been provided for this image
WARNING: Unknown type for standard_scale, ignored
No description has been provided for this image
No description has been provided for this image
WARNING: Unknown type for standard_scale, ignored
No description has been provided for this image
No description has been provided for this image
WARNING: Unknown type for standard_scale, ignored
No description has been provided for this image
No description has been provided for this image
WARNING: Unknown type for standard_scale, ignored
No description has been provided for this image
No description has been provided for this image
WARNING: Unknown type for standard_scale, ignored
No description has been provided for this image
No description has been provided for this image
WARNING: Unknown type for standard_scale, ignored
No description has been provided for this image
No description has been provided for this image
WARNING: Unknown type for standard_scale, ignored
No description has been provided for this image
No description has been provided for this image
WARNING: Unknown type for standard_scale, ignored
No description has been provided for this image
No description has been provided for this image
WARNING: Unknown type for standard_scale, ignored
No description has been provided for this image
================================================================================
Significant Senescence Gene Contrasts
================================================================================

['Pigf', 'Bex3', 'Hmgb1', 'Mif']
Out[37]:
log_fc logCPM F p_value adj_p_value contrast abs_log_fc
variable
Pigf 0.351961 3.954538 13.143226 4.024638e-04 5.212639e-03 None 0.351961
Bex3 0.953014 5.195395 42.328285 1.485855e-09 7.042051e-08 None 0.953014
Hmgb1 0.400718 6.081534 16.838421 7.199312e-05 1.145922e-03 None 0.400718
Mif 1.143501 5.730556 82.364941 1.637643e-15 4.402347e-13 None 1.143501

SnC DEGs¶

SnCs vs. Not¶

Slc23a2

Overall¶
In [32]:
out_edgr_contrasts_snc = scflow.ax.run_deg_edgr(
    self.rna, "Senescent_Cell_Label",
    col_covariate=col_batch, formula=None,
    key_treatment="Senescent", key_control="Non-Senescent",
    log2fc_thresh=0, n_top_vars=24, xlabel_rotation=45,
    hspace=0.5, wspace=0.2, top=0.92, legend_loc="upper right",
    col_celltype=col_celltype, col_sample=col_sample)
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Performing pseudobulk for paired samples
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
No description has been provided for this image
No description has been provided for this image
Rank Genes Groups¶
In [225]:
res_rank_genes, p_threshold = {}, 1e-10
for x in self.rna.obs[col_batch].unique():
    res_rank_genes[x] = {}
    for c in self.rna.obs[self.rna.obs[col_batch] == x][col_celltype].unique():
        s_iter = (self.rna.obs[col_batch] == x) & (self.rna.obs[
            "Senescent_Cell_Label_by_Type"].isin([c, f"SnC {c}"]))
        tmp = sc.tl.rank_genes_groups(
            self.rna[s_iter], "Senescent_Cell_Label_by_Type", rankby_abs=True,
            layer="log1p", groups=[c, f"SnC {c}"], reference=c, copy=True)
        res_rank_genes[x][c] = sc.get.rank_genes_groups_df(
            tmp, f"SnC {c}", pval_cutoff=p_threshold)
    tmp = sc.tl.rank_genes_groups(
            self.rna[self.rna.obs[col_batch] == x],
            "Senescent_Cell_Label", rankby_abs=True,
            layer="log1p", reference="Non-Senescent", copy=True)
    res_rank_genes[x]["Overall"] = sc.get.rank_genes_groups_df(
            tmp, f"Senescent", pval_cutoff=p_threshold)
    res_rank_genes[x] = pd.concat(res_rank_genes[x], names=[col_celltype])
res_rank_genes = pd.concat(res_rank_genes, names=[col_batch])
res_rank_genes = res_rank_genes.assign(
    logfoldchanges_abs=res_rank_genes.logfoldchanges.abs())
res_rank_genes_top = res_rank_genes.reset_index().groupby([
    col_batch, col_celltype]).apply(
        lambda x: x.sort_values("logfoldchanges_abs").iloc[:20],
        include_groups=False).reset_index(2, drop=True).set_index(
            "names", append=True).rename_axis([
                col_batch, col_celltype, "variable"])
res_rank_genes_top
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
... storing 'scCODA_sample_id' as categorical
Out[225]:
level_2 scores logfoldchanges pvals pvals_adj logfoldchanges_abs
Group annotation_by_overlap variable
Ground Control | 12 Weeks Astrocyte Paqr8 582 -11.625196 -3.957662 2.459272e-13 1.731654e-12 3.957662
Brinp3 765 -10.685084 -3.974858 1.843256e-12 1.225158e-11 3.974858
Nrxn2 744 -10.750609 -4.002379 2.766084e-13 1.937540e-12 4.002379
Fgf14 563 -11.757295 -4.031304 2.039633e-13 1.445581e-12 4.031304
Grm3 834 -10.358327 -4.042312 6.421581e-12 4.112328e-11 4.042312
... ... ... ... ... ... ... ... ...
Space Flight | 29 Weeks Overall Ccser1 184 -7.551204 -0.874172 2.517150e-13 1.645944e-11 0.874172
Prickle1 215 -7.282249 -0.879054 1.517610e-12 8.499319e-11 0.879054
Kcnq1ot1 176 -7.600009 -0.881908 1.812542e-13 1.224934e-11 0.881908
Kalrn 197 -7.432727 -0.883547 5.562165e-13 3.398258e-11 0.883547
Dst 113 -8.208591 -0.890387 2.550492e-15 2.659767e-13 0.890387

640 rows × 6 columns

By Condition (Just Aged)¶
In [143]:
# Ager Subset
subset_old = self.rna.obs[col_age] == keys[col_age]["key_treatment"]

# Old Ground Control SnCs
print(f"\n\n{'=' * 80}\nGround Control (Aged)\n{'=' * 80}\n\n")
subset_gc = self.rna.obs[col_condition] == keys[
    col_condition]["key_control"]
out_edgr_contrasts_snc_gc = scflow.ax.run_deg_edgr(
    self.rna[subset_gc & subset_old], "Senescent_Cell_Label",
    key_treatment="Senescent", top=0.92,
    key_control="Non-Senescent", log2fc_thresh=0, n_top_vars=24,
    xlabel_rotation=45, hspace=0.5, wspace=0.2, legend_loc="upper right",
    col_celltype=col_celltype, col_sample=col_sample)
if len(self.rna[subset_gc & subset_old].obs[col_batch].unique()) > 1:
    raise ValueError("Check subsetting")
key_1 = self.rna[subset_gc & subset_old].obs[col_batch].unique()[0]

# Old Spaceflight SnCs
print(f"\n\n{'=' * 80}\nSpaceflight (Aged)\n{'=' * 80}\n\n")
subset_sf = self.rna.obs[col_condition] == keys[
    col_condition]["key_treatment"]
out_edgr_contrasts_snc_sf = scflow.ax.run_deg_edgr(
    self.rna[subset_sf & subset_old], "Senescent_Cell_Label",
    key_treatment="Senescent", key_control="Non-Senescent",
    log2fc_thresh=0, n_top_vars=24, xlabel_rotation=45,
    hspace=0.5, wspace=0.2, top=0.92, legend_loc="upper right",
    col_celltype=col_celltype, col_sample=col_sample)
if len(self.rna[subset_sf & subset_old].obs[col_batch].unique()) > 1:
    raise ValueError("Check subsetting")
key_2 = self.rna[subset_sf & subset_old].obs[col_batch].unique()[0]

# Compare
res_snc_gc = out_edgr_contrasts_snc_gc[0][out_edgr_contrasts_snc_gc[
    0].adj_p_value < 0.001].sort_values("adj_p_value").set_index("variable")
res_snc_sf = out_edgr_contrasts_snc_sf[0][out_edgr_contrasts_snc_sf[
    0].adj_p_value < 0.001].sort_values("adj_p_value").set_index("variable")
res_snc_grps = pd.concat([
    res_snc_gc, res_snc_sf], keys=[key_1, key_2], names=[col_condition])
res_snc_grps = res_snc_grps[res_snc_grps.abs_log_fc >= 1]
# top_tx_g_snc = res_snc_grps.loc[keys[col_condition][
#     "key_treatment"]].sort_values("abs_log_fc", ascending=False).index
# print(res_snc_grps.unstack(0).replace(np.nan, "")[[
#     "log_fc", "adj_p_value"]].loc[top_tx_g_snc])
# just_sf = res_snc_grps.loc[keys[col_condition][
#     "key_treatment"]].index.difference(res_snc_grps.loc[keys[
#         col_condition]["key_control"]].index)
# just_gc = res_snc_grps.loc[keys[col_condition][
#     "key_control"]].index.difference(res_snc_grps.loc[keys[
#         col_condition]["key_treatment"]].index)
# print(res_snc_grps.loc[:, just_gc, :].sort_values(
#     "abs_log_fc", ascending=False)[["log_fc", "adj_p_value"]], "\n\n")
# res_snc_grps.loc[:, just_sf, :].sort_values(
#     "abs_log_fc", ascending=False)[["log_fc", "adj_p_value"]]
res_snc_grps.unstack(0).replace(np.nan, "")[["log_fc", "adj_p_value"]]

================================================================================
Spaceflight (Aged)
================================================================================


• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
File ~/miniconda3/envs/rsc/lib/python3.13/site-packages/pandas/core/indexes/base.py:3805, in Index.get_loc(self, key)
   3804 try:
-> 3805     return self._engine.get_loc(casted_key)
   3806 except KeyError as err:

File index.pyx:167, in pandas._libs.index.IndexEngine.get_loc()

File index.pyx:196, in pandas._libs.index.IndexEngine.get_loc()

File pandas/_libs/hashtable_class_helper.pxi:7081, in pandas._libs.hashtable.PyObjectHashTable.get_item()

File pandas/_libs/hashtable_class_helper.pxi:7089, in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 'Space Flight'

The above exception was the direct cause of the following exception:

KeyError                                  Traceback (most recent call last)
Cell In[143], line 40
     37 res_snc_grps = pd.concat([
     38     res_snc_gc, res_snc_sf], keys=[key_1, key_2], names=[col_condition])
     39 res_snc_grps = res_snc_grps[res_snc_grps.abs_log_fc >= 1]
---> 40 top_tx_g_snc = res_snc_grps.loc[keys[col_condition][
     41     "key_treatment"]].sort_values("abs_log_fc", ascending=False).index
     42 # print(res_snc_grps.unstack(0).replace(np.nan, "")[[
     43 #     "log_fc", "adj_p_value"]].loc[top_tx_g_snc])
     44 # just_sf = res_snc_grps.loc[keys[col_condition][
   (...)     52 # res_snc_grps.loc[:, just_sf, :].sort_values(
     53 #     "abs_log_fc", ascending=False)[["log_fc", "adj_p_value"]]
     54 res_snc_grps.unstack(0).replace(np.nan, "")[["log_fc", "adj_p_value"]]

File ~/miniconda3/envs/rsc/lib/python3.13/site-packages/pandas/core/indexing.py:1191, in _LocationIndexer.__getitem__(self, key)
   1189 maybe_callable = com.apply_if_callable(key, self.obj)
   1190 maybe_callable = self._check_deprecated_callable_usage(key, maybe_callable)
-> 1191 return self._getitem_axis(maybe_callable, axis=axis)

File ~/miniconda3/envs/rsc/lib/python3.13/site-packages/pandas/core/indexing.py:1431, in _LocIndexer._getitem_axis(self, key, axis)
   1429 # fall thru to straight lookup
   1430 self._validate_key(key, axis)
-> 1431 return self._get_label(key, axis=axis)

File ~/miniconda3/envs/rsc/lib/python3.13/site-packages/pandas/core/indexing.py:1381, in _LocIndexer._get_label(self, label, axis)
   1379 def _get_label(self, label, axis: AxisInt):
   1380     # GH#5567 this will fail if the label is not present in the axis.
-> 1381     return self.obj.xs(label, axis=axis)

File ~/miniconda3/envs/rsc/lib/python3.13/site-packages/pandas/core/generic.py:4293, in NDFrame.xs(self, key, axis, level, drop_level)
   4290     index = self.index
   4292 if isinstance(index, MultiIndex):
-> 4293     loc, new_index = index._get_loc_level(key, level=0)
   4294     if not drop_level:
   4295         if lib.is_integer(loc):
   4296             # Slice index must be an integer or None

File ~/miniconda3/envs/rsc/lib/python3.13/site-packages/pandas/core/indexes/multi.py:3290, in MultiIndex._get_loc_level(self, key, level)
   3288         return indexer, maybe_mi_droplevels(indexer, ilevels)
   3289 else:
-> 3290     indexer = self._get_level_indexer(key, level=level)
   3291     if (
   3292         isinstance(key, str)
   3293         and self.levels[level]._supports_partial_string_indexing
   3294     ):
   3295         # check to see if we did an exact lookup vs sliced
   3296         check = self.levels[level].get_loc(key)

File ~/miniconda3/envs/rsc/lib/python3.13/site-packages/pandas/core/indexes/multi.py:3391, in MultiIndex._get_level_indexer(self, key, level, indexer)
   3388         return slice(i, j, step)
   3390 else:
-> 3391     idx = self._get_loc_single_level_index(level_index, key)
   3393     if level > 0 or self._lexsort_depth == 0:
   3394         # Desired level is not sorted
   3395         if isinstance(idx, slice):
   3396             # test_get_loc_partial_timestamp_multiindex

File ~/miniconda3/envs/rsc/lib/python3.13/site-packages/pandas/core/indexes/multi.py:2980, in MultiIndex._get_loc_single_level_index(self, level_index, key)
   2978     return -1
   2979 else:
-> 2980     return level_index.get_loc(key)

File ~/miniconda3/envs/rsc/lib/python3.13/site-packages/pandas/core/indexes/base.py:3812, in Index.get_loc(self, key)
   3807     if isinstance(casted_key, slice) or (
   3808         isinstance(casted_key, abc.Iterable)
   3809         and any(isinstance(x, slice) for x in casted_key)
   3810     ):
   3811         raise InvalidIndexError(key)
-> 3812     raise KeyError(key) from err
   3813 except TypeError:
   3814     # If we have a listlike key, _check_indexing_error will raise
   3815     #  InvalidIndexError. Otherwise we fall through and re-raise
   3816     #  the TypeError.
   3817     self._check_indexing_error(key)

KeyError: 'Space Flight'
No description has been provided for this image

SnC as Covariate¶

In [33]:
out_edgr_contrasts_snc_cov = {}
for a in self.rna.obs[col_age].unique():
    print(f"\n\n{'=' * 80}\nAge = {a}\n{'=' * 80}\n\n")
    out_edgr_contrasts_snc_cov[a] = scflow.ax.run_deg_edgr(
        self.rna[self.rna.obs[col_age] == a], col_condition,
        col_covariate="Senescent_Cell_Label",
        **keys[col_condition], log2fc_thresh=0, n_top_vars=24,
        xlabel_rotation=45, hspace=0.5, wspace=0.2, top=0.85,
        legend_loc="upper right", col_celltype=col_celltype,
        col_sample=col_sample)
    plt.show()

================================================================================
Age = 20 Weeks
================================================================================


• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Performing pseudobulk for paired samples
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
No description has been provided for this image
No description has been provided for this image

================================================================================
Age = 37 Weeks
================================================================================


• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Performing pseudobulk for paired samples
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/seaborn/categorical.py:700: PendingDeprecationWarning: vert: bool will be deprecated in a future version. Use orientation: {'vertical', 'horizontal'} instead.
  artists = ax.bxp(**boxplot_kws)
No description has been provided for this image
No description has been provided for this image

Just SnCs¶

All Groups SnCs¶
In [ ]:
out_edgr_groups_snc = scflow.ax.run_deg_edgr(
    self.rna[(self.rna.obs["Senescent_Cell_Label"] == "Senescent")],
    col_batch, **keys[col_batch], col_sample=col_sample,
    log2fc_thresh=0, n_top_vars=25, col_celltype=col_celltype)
print(list(out_edgr_groups[0].variable[:25]))
out_edgr_batches_snc = out_edgr_groups[0][(
    out_edgr_groups[0].abs_log_fc > 1) & (
        out_edgr_groups[0].adj_p_value < 0.001)].sort_values(
            "adj_p_value", ascending=True)
out_edgr_batches_top = out_edgr_batches.groupby("contrast").apply(
    lambda x: x.sort_values("adj_p_value", ascending=True).iloc[
        :20]).set_index("variable", append=True).reset_index(
            1, drop=True).rename_axis([col_condition, "variable"])
plt.show()
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
['Ndufs8', 'Taco1', 'Uqcrb', 'Atp5e', 'Spcs1', 'Ubqln2', 'Snrpd2', 'Stk35', 'Psenen', 'Ndufa4', 'Mif', 'Tmsb10', 'AY036118', 'Atp6v0c', 'Chchd10', 'Cox7c', 'Ndufa13', 'Hsp90ab1', 'Ndufb11', 'Ddost', 'Ubb', 'Sco2', 'Bet1l', 'Atp5o-1', 'Ndufb10']
/tmp/ipykernel_939743/4169309774.py:10: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  out_edgr_batches_top = out_edgr_batches.groupby("contrast").apply(
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[236], line 14
      6 out_edgr_batches_snc = out_edgr_groups[0][(
      7     out_edgr_groups[0].abs_log_fc > 1) & (
      8         out_edgr_groups[0].adj_p_value < 0.001)].sort_values(
      9             "adj_p_value", ascending=True)
     10 out_edgr_batches_top = out_edgr_batches.groupby("contrast").apply(
     11     lambda x: x.sort_values("adj_p_value", ascending=True).iloc[
     12         :20]).set_index("variable", append=True).reset_index(
     13             1, drop=True).rename_axis([col_condition, "variable"])
---> 14 plt.show(dpi=200)

File ~/miniconda3/envs/rsc/lib/python3.13/site-packages/matplotlib/pyplot.py:614, in show(*args, **kwargs)
    570 """
    571 Display all open figures.
    572 
   (...)    611 explicitly there.
    612 """
    613 _warn_if_gui_out_of_main_thread()
--> 614 return _get_backend_mod().show(*args, **kwargs)

TypeError: show() got an unexpected keyword argument 'dpi'
No description has been provided for this image
SF vs. Aged GC¶
In [98]:
# subs_old = self.rna.obs[col_age] == keys[col_age]["key_treatment"]
# subs_sf = self.rna.obs[col_condition] == keys[
#     col_condition]["key_treatment"]
# subs_noynggc_snc = (self.rna.obs[
#     "Senescent_Cell_Label"] == "Senescent") & (
#     subs_old | subs_sf)
# # ktx = keys[col_batch]["key_treatment"][1:]
# ktx = [keys[col_batch]["key_control"]] + keys[
#     col_batch]["key_treatment"][1:]
# out_edgr_groups_snc = scflow.ax.run_deg_edgr(
#     # self.rna[subs_noynggc_snc],
#     self.rna,
#     col_batch, col_sample=col_sample,
#     key_control=keys[col_batch]["key_treatment"][0],
#     key_treatment=ktx,
#     log2fc_thresh=0, n_top_vars=25, col_celltype=col_celltype)
# print(list(out_edgr_groups[0].variable[:25]))
# out_edgr_batches_snc = out_edgr_groups[0][(
#     out_edgr_groups[0].abs_log_fc > 1) & (
#         out_edgr_groups[0].adj_p_value < 0.001)].sort_values(
#             "adj_p_value", ascending=True)
# out_edgr_batches_top = out_edgr_batches.groupby("contrast").apply(
#     lambda x: x.sort_values("adj_p_value", ascending=True).iloc[
#         :20], include_groups=False).set_index(
#             "variable", append=True).reset_index(
#                 1, drop=True).rename_axis([col_condition, "variable"])
# plt.show()
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
['Ndufs8', 'Taco1', 'Uqcrb', 'Atp5e', 'Spcs1', 'Ubqln2', 'Snrpd2', 'Stk35', 'Psenen', 'Ndufa4', 'Mif', 'Tmsb10', 'AY036118', 'Atp6v0c', 'Chchd10', 'Cox7c', 'Ndufa13', 'Hsp90ab1', 'Ndufb11', 'Ddost', 'Ubb', 'Sco2', 'Bet1l', 'Atp5o-1', 'Ndufb10']
No description has been provided for this image
Just Aged SnCs¶
In [28]:
out_edgr_contrasts_sncto, snc_degs_by_condition_age_ct = {}, {}
thresh_p_c, thresh_lfcabs_c = 0.05, 0.5  # thresholds
subs_old = self.rna.obs[col_age] == keys[col_age]["key_treatment"]
subs_sf = self.rna.obs[col_condition] == keys[col_condition]["key_treatment"]
# subs_ac = (self.rna.obs["Senescent_Cell_Label"] == "Senescent") & (
#     subs_old | subs_sf)
subs_ac = (self.rna.obs["Senescent_Cell_Label"] == "Senescent") & (subs_old)
out_edgr_contrasts_sncto["Overall"] = scflow.ax.run_deg_edgr(
        self.rna[subs_ac], col_condition,
        # col_covariate=col_age,
        **keys[col_condition],
        log2fc_thresh=0, n_top_vars=24,
        legend_loc="upper center", fig_title=f"Overall",
        wspace=0.25, bottom=0.3, hspace=1 if len(x) > 10 else 0.4, top=0.95,
        kws_xticks=dict(fontsize=10, rotation=45 if len(x) > 10 else None),
        col_celltype=col_celltype, col_sample=col_sample)
plt.show()
tmp = out_edgr_contrasts_sncto["Overall"][0]
tmp = tmp[(tmp.adj_p_value < thresh_p_c) & (
    tmp.abs_log_fc >= thresh_lfcabs_c)]  # filter by p & lfc
snc_degs_by_condition_age_ct["Overall"] = list(
    tmp.sort_values("adj_p_value", ascending=True).variable)
for x in self.rna.obs[col_celltype].unique():
    print(x)
    out_edgr_contrasts_sncto[x] = scflow.ax.run_deg_edgr(
        self.rna[(subs_ac) & (self.rna.obs[col_celltype] == x)],
        col_condition,
        # col_covariate=col_age,
        **keys[col_condition],
        log2fc_thresh=0, n_top_vars=24,
        legend_loc="upper center", fig_title=f"Senescent {x}",
        wspace=0.25, bottom=0.3, hspace=1 if len(x) > 10 else 0.4, top=0.95,
        kws_xticks=dict(fontsize=10, rotation=45 if len(x) > 10 else None),
        col_celltype=col_celltype, col_sample=col_sample)
    plt.show()
    tmp = out_edgr_contrasts_sncto[x][0]
    tmp = tmp[(tmp.adj_p_value < thresh_p_c) & (
        tmp.abs_log_fc >= thresh_lfcabs_c)]  # filter by p & lfc
    snc_degs_by_condition_age_ct[x] = list(tmp.sort_values(
            "adj_p_value", ascending=True).variable)
    del tmp
out_edgr_contrasts_snc_all_top = pd.concat([out_edgr_contrasts_sncto[x][
    0].set_index("variable").loc[snc_degs_by_condition_age_ct[
        x]] for x in out_edgr_contrasts_sncto], keys=out_edgr_contrasts_sncto,
                                           names=[col_celltype])
out_edgr_contrasts_snc_all = pd.concat([
    out_edgr_contrasts_sncto[x][0].set_index("variable")
    for x in out_edgr_contrasts_sncto], keys=out_edgr_contrasts_sncto,
                                       names=[col_celltype])
out_edgr_contrasts_snc_all_top
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
No description has been provided for this image
Excitatory
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
No description has been provided for this image
Excitatory-Inhibitory
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
No description has been provided for this image
Oligodendrocyte
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
No description has been provided for this image
Inhibitory
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
No description has been provided for this image
Microglial
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
No description has been provided for this image
OPC
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
No description has been provided for this image
Astrocyte
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
• Calculating NormFactors
• Estimating Dispersions
• Fitting linear model
No description has been provided for this image
Out[28]:
log_fc logCPM F p_value adj_p_value contrast abs_log_fc significance
annotation_by_overlap variable
Excitatory Mir6236 2.785393 8.852131 24.576078 7.684583e-07 0.009296 Space Flight 2.785393 < 0.01
Astrocyte Slc4a10 -4.664966 9.805859 32.261728 1.393764e-08 0.000169 Space Flight 4.664966 < 0.001
Ccn3 -4.767686 9.181761 28.629274 9.003095e-08 0.000409 Space Flight 4.767686 < 0.001
Chrm3 -6.454060 8.549329 28.399240 1.013490e-07 0.000409 Space Flight 6.454060 < 0.001
Rorb 6.667245 9.297352 22.394432 2.257624e-06 0.006828 Space Flight 6.667245 < 0.01
Rspo3 -3.907725 8.962092 21.132434 4.350717e-06 0.010526 Space Flight 3.907725 < 0.1
Fxyd5 -4.017004 8.674347 19.493648 1.022373e-05 0.020613 Space Flight 4.017004 < 0.1
Bche -5.609772 8.050771 18.246627 1.962775e-05 0.033920 Space Flight 5.609772 < 0.1
Tmeff2 -3.229761 9.214059 17.357692 3.128428e-05 0.047306 Space Flight 3.229761 < 0.1

Pathway Analysis: SnC DEGs¶

In [102]:
# Pathway Enrichment Analysis
names = gp.get_library_name()
# [i for i in names if "brain" in i.lower() or "mouse" in i.lower()]
pathways_snc, res_pathways_snc = {}, {}
thresh_p_path = 0.05
# perts_geo = ["Aging", "Drug", "Disease"]
perts_geo = ["Aging", "Disease"]
other_sets = ["GTEx_Aging_Signatures_2021", f"HDSigDB_{species}_2021",
              # "DGIdb_Drug_Targets_2024",
              "MSigDB_Hallmark_2020",
              "MSigDB_Oncogenic_Signatures", "OMIM_Disease",
              # "Reactome_Pathways_2024", "Reactome_2022",
              f"WikiPathways_2024_{species}", f"WikiPathways_2019_{species}"]
other_sets += [i for i in names if "GO_Biological_Process" in i]
# if species.lower() == "mouse":
#     other_sets += ["PerturbAtlas_MouseGenePerturbationSigs"]
for x in out_edgr_contrasts_snc_all_top.reset_index()[col_celltype].unique():
    pathways_snc[x], res_pathways_snc[x] = {}, {}
    for i in ["up", "down"]:
        degs_tmp = out_edgr_contrasts_snc_all_top.loc[x]
        if i == "up":
            degs_tmp = list(degs_tmp[degs_tmp.log_fc > 0].index.values)
        else:
            degs_tmp = list(degs_tmp[degs_tmp.log_fc < 0].index.values)
        if len(degs_tmp) > 0:
            g_s = [f"{u}_Perturbations_from_GEO_{i}" for u in perts_geo] + [
                f"Disease_Signatures_from_GEO_{i}_2014"] + other_sets
            g_s = [g for g in g_s if g in names]
            pathways_snc[x][i] = gp.enrichr(
                gene_list=degs_tmp, gene_sets=g_s,
                organism=species, cutoff=0.5)
            # fig = gp.barplot(pathways_snc[x][i].res2d, title=f"{x} ({i})",
            #                  color="r" if i == "up" else "b")
            res_pathways_snc[x][i] = pathways_snc[x][i].results[pathways_snc[
                x][i].results["Adjusted P-value"] < thresh_p_path]
    res_pathways_snc[x] = pd.concat(res_pathways_snc[x], names=["Direction"])
res_pathways_snc = pd.concat(res_pathways_snc, names=[col_celltype])
res_pathways_snc.loc[:, "Term Short"] = res_pathways_snc.Term.apply(
    lambda x: re.sub("Expression Of ", "", re.sub(".*.xls", "", re.sub(
        ".*.XLSX", "", re.sub(".*Supplementary Table [0-9]+[-]?", "", re.sub(
            ".*.xlsx.", "", re.sub(".*Supplementary Data ..", "", re.sub(
                "PMID([0-9])+", "", re.sub(
                    "([0-9]+) years v ([0-9]+) years", "\\1 v \\2 yrs.",
                    re.sub("aging:([0-9]+)", "aging", re.sub(
                        "([0-9]+) months v ([0-9]+) mo(nths)?",
                        "\\1 v \\2 mo.", re.sub("SRP[0-9]+ ", "", re.sub(
                            "GSE[0-9]+ ", "", x)))))))))))))
cts_i = res_pathways_snc.reset_index()[col_celltype].unique()
res_pathways_snc_top = res_pathways_snc.reset_index().groupby([
    col_celltype, "Direction"]).apply(lambda x: x.sort_values(
        "Adjusted P-value", ascending=True).head(10), include_groups=False)
# res_pathways_snc_top = res_pathways_snc_top[res_pathways_snc_top[
#     "Gene_set"] != "PheWeb_2019"]

# Plot/Display
fig, axes = plt.subplots(*scflow.pl.square_grid(cts_i), figsize=(
    20, 25), gridspec_kw=dict(wspace=1.5, top=0.95), squeeze=False)
for i, x in enumerate(cts_i):
    gp.dotplot(
        res_pathways_snc_top.loc[x].reset_index(),
        column="Adjusted P-value",
        # column="Overlap",
        x="Direction", y="Term Short",
        ax=axes.flatten()[i], size=20, top_term=100,
        title=x, xticklabels_rot=45, yticklabels_rot=45,
        show_ring=True, marker="o", cutoff=0.5)
    axes.flatten()[i].tick_params(axis="y", labelsize=8,
                                  labelfontfamily="serif")
    axes.flatten()[i].tick_params(axis="x", labelsize=10,
                                  labelfontfamily="serif")
    axes.flatten()[i].title.set_fontsize(10)
if len(axes.flatten()) > len(cts_i):
    for a in axes.flatten()[len(cts_i):]:
        a.set_visible(False)
fig.suptitle("Senescent Cell Spaceflight DEGs", fontsize="xx-large",
             fontproperties=dict(family="serif"))
# for x in cts_i:
#     a_x = gp.dotplot(
#         res_pathways_snc_top.loc[x].reset_index(),
#         column="Adjusted P-value",
#         x="Direction", y="Term Short",
#         size=10, top_term=5, figsize=(3, 8),
#         title=x, xticklabels_rot=45, yticklabels_rot=45,
#         show_ring=True, marker="o", cutoff=0.1)
#     a_x.tick_params(axis="y", labelsize=6)
#     a_x.tick_params(axis="x", labelsize=10)
# res_pathways_snc_top.loc["Overall"].reset_index(1)[[
#     "Gene_set", "Term Short", "Adjusted P-value", "Genes"]].reset_index(
#         ).groupby(["Direction", "Gene_set", "Term Short"]).apply(
#             lambda x: x.apply(lambda y: y.Genes.split(";"), axis=1),
#             include_groups=False).reset_index(-1, drop=True).to_frame(
#                 "Gene")
res_pathways_snc_top[["Term Short"] + list(
    res_pathways_snc_top.columns.difference(["Term", "Term Short"]))]
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
Out[102]:
Term Short Adjusted P-value Combined Score Gene_set Genes Odds Ratio Old Adjusted P-value Old P-value Overlap P-value level_2
annotation_by_overlap Direction
Astrocyte down 97 GTEx Ovary 20-29 vs 30-39 Up 0.000781 577.981962 GTEx_Aging_Signatures_2021 BCHE;RSPO3;CCN3 59.957490 0 0 3/250 0.000065 152
98 GTEx Ovary 20-29 vs 40-49 Up 0.000781 577.981962 GTEx_Aging_Signatures_2021 BCHE;RSPO3;CCN3 59.957490 0 0 3/250 0.000065 153
99 GTEx Brain 20-29 vs 50-59 Down 0.000781 577.981962 GTEx_Aging_Signatures_2021 CHRM3;SLC4A10;RSPO3 59.957490 0 0 3/250 0.000065 154
110 regulation of ion transmembrane transporter activity (GO:0032412) 0.007965 2042.516553 GO_Biological_Process_2021 CHRM3;FXYD5 215.740541 0 0 2/39 0.000077 924
103 Genes Changed In Brain Vs Spinal Cord Derived OPCs From P7 Mice 0.016494 305.164580 HDSigDB_Mouse_2021 CHRM3;BCHE;TMEFF2;CCN3;FXYD5 30.557209 0 0 5/1517 0.000046 189
102 Striatum RNA M44 Module (Floralwhite) 0.016494 797.520726 HDSigDB_Mouse_2021 CHRM3;RSPO3;CCN3 76.943005 0 0 3/196 0.000032 188
111 regulation of integrin biosynthetic process (GO:0045113) 0.019272 5287.722500 GO_Biological_Process_2021 TMEFF2 832.875000 0 0 1/5 0.001749 925
112 regulation of vascular associated smooth muscle contraction (GO:0003056) 0.019272 5287.722500 GO_Biological_Process_2021 CHRM3 832.875000 0 0 1/5 0.001749 926
120 regulation of Wnt signaling pathway, planar cell polarity pathway (GO:2000095) 0.019272 2398.853181 GO_Biological_Process_2021 RSPO3 416.354167 0 0 1/9 0.003146 934
119 adenylate cyclase-inhibiting G protein-coupled acetylcholine receptor signaling pathway (GO:0007... 0.019272 2797.660500 GO_Biological_Process_2021 CHRM3 475.857143 0 0 1/8 0.002797 933
up 43 retinal cone cell development (GO:0046549) 0.002625 162186.518632 GO_Biological_Process_2021 RORB 19994.000000 0 0 1/6 0.000300 177
42 amacrine cell differentiation (GO:0035881) 0.002625 165840.178437 GO_Biological_Process_2021 RORB 19995.000000 0 0 1/5 0.000250 176
45 retinal rod cell development (GO:0046548) 0.002625 159096.448716 GO_Biological_Process_2021 RORB 19993.000000 0 0 1/7 0.000350 179
44 retinal cone cell differentiation (GO:0042670) 0.002625 162186.518632 GO_Biological_Process_2021 RORB 19994.000000 0 0 1/6 0.000300 178
46 retinal rod cell differentiation (GO:0060221) 0.002700 154056.469240 GO_Biological_Process_2021 RORB 19991.000000 0 0 1/9 0.000450 180
48 photoreceptor cell development (GO:0042461) 0.002812 143801.308860 GO_Biological_Process_2021 RORB 19985.000000 0 0 1/15 0.000750 182
47 eye photoreceptor cell differentiation (GO:0001754) 0.002812 148283.119629 GO_Biological_Process_2021 RORB 19988.000000 0 0 1/12 0.000600 181
49 eye photoreceptor cell development (GO:0042462) 0.002812 143801.308860 GO_Biological_Process_2021 RORB 19985.000000 0 0 1/15 0.000750 183
68 Eye Photoreceptor Cell Development (GO:0042462) 0.003675 146675.876168 GO_Biological_Process_2023 RORB 19987.000000 0 0 1/13 0.000650 208
69 Photoreceptor Cell Development (GO:0042461) 0.003675 145187.405357 GO_Biological_Process_2023 RORB 19986.000000 0 0 1/14 0.000700 209
No description has been provided for this image

Run ToppGene on SnC DEGs¶

In [50]:
# res_deg_4, res_deg_old_sf_v_gc = [i[0] for i in [
#         out_edgr_contrasts, out_edgr_con]]
# res_deg_4, res_deg_old_sf_v_gc = [i[(i.adj_p_value < 0.05) & (
#     i.abs_log_fc >= 1)].sort_values(
#         "abs_log_fc", ascending=False)
#     for i in [res_deg_4, res_deg_old_sf_v_gc]]
mks_ctrsts_snc = dict(out_edgr_contrasts_snc_all_top.reset_index(
    1).variable.groupby(col_celltype).apply(lambda x: list(x)))  # SnC DEGs
results_toppgene_degs = scflow.pp.annotate_by_toppgene(
    mks_ctrsts_snc, species=species, min_genes=1,
    categories=["Pathway", "PubMed"])
results_toppgene_degs = results_toppgene_degs.join(pd.Series(
    mks_ctrsts_snc).to_frame("DEGs").rename_axis("Gene Set"))
results_toppgene_degs = results_toppgene_degs.groupby("Gene Set").apply(
    lambda x: x.sort_values("PValue", ascending=True), include_groups=False)
pthwys = dict(results_toppgene_degs.groupby("Gene Set").apply(
    lambda x: [i.capitalize() for i in x.Name.unique()]))
print("\n\n".join([f"{k}: {pthwys[k]}" for k in pthwys]))
results_toppgene_degs[["Name", "Symbols", "GenesInTerm", "GenesInQuery",
                       "GenesInTermInQuery", "PValue"]].reset_index(
                           2, drop=True)
Astrocyte: ['Reactome_muscarinic_acetylcholine_receptors', 'Reactome_runx1_regulates_transcription_of_genes_involved_in_wnt_signaling', 'Reactome_bicarbonate_transporters', 'Reactome_acetylcholine_regulates_insulin_secretion', 'Reactome_neurotransmitter_clearance', 'Wp_irinotecan_pathway', 'Wp_nephrogenesis', 'Reactome_synthesis_secretion_and_deacylation_of_ghrelin', 'Kegg_medicus_reference_wnt_signaling_modulation_lgr_rspo', 'Kegg_medicus_reference_machr_ca2_apoptotic_pathway', 'Reactome_regulation_of_fzd_by_ubiquitination', 'Kegg_medicus_variant_mutation_caused_aberrant_abeta_to_machr_ca2_apoptotic_pathway']
Out[50]:
Name Symbols GenesInTerm GenesInQuery GenesInTermInQuery PValue
Gene Set Gene Set ID
Astrocyte Astrocyte M27300 REACTOME_MUSCARINIC_ACETYLCHOLINE_RECEPTORS [CHRM3] 5 7 1 0.002481
MM15006 REACTOME_MUSCARINIC_ACETYLCHOLINE_RECEPTORS [CHRM3] 5 7 1 0.002481
M27801 REACTOME_RUNX1_REGULATES_TRANSCRIPTION_OF_GENES_INVOLVED_IN_WNT_SIGNALING [RSPO3] 6 7 1 0.002976
M27335 REACTOME_BICARBONATE_TRANSPORTERS [SLC4A10] 10 7 1 0.004956
M1825 REACTOME_ACETYLCHOLINE_REGULATES_INSULIN_SECRETION [CHRM3] 10 7 1 0.004956
MM15073 REACTOME_BICARBONATE_TRANSPORTERS [SLC4A10] 10 7 1 0.004956
M26914 REACTOME_NEUROTRANSMITTER_CLEARANCE [BCHE] 11 7 1 0.005451
M39611 WP_IRINOTECAN_PATHWAY [BCHE] 12 7 1 0.005945
M40045 WP_NEPHROGENESIS [RSPO3] 18 7 1 0.008906
M813 REACTOME_SYNTHESIS_SECRETION_AND_DEACYLATION_OF_GHRELIN [BCHE] 19 7 1 0.009399
M47833 KEGG_MEDICUS_REFERENCE_WNT_SIGNALING_MODULATION_LGR_RSPO [RSPO3] 19 7 1 0.009399
M47688 KEGG_MEDICUS_REFERENCE_MACHR_CA2_APOPTOTIC_PATHWAY [CHRM3] 20 7 1 0.009891
MM15155 REACTOME_REGULATION_OF_FZD_BY_UBIQUITINATION [RSPO3] 20 7 1 0.009891
MM15070 REACTOME_SYNTHESIS_SECRETION_AND_DEACYLATION_OF_GHRELIN [BCHE] 20 7 1 0.009891
M47689 KEGG_MEDICUS_VARIANT_MUTATION_CAUSED_ABERRANT_ABETA_TO_MACHR_CA2_APOPTOTIC_PATHWAY [CHRM3] 21 7 1 0.010383
M27401 REACTOME_REGULATION_OF_FZD_BY_UBIQUITINATION [RSPO3] 21 7 1 0.010383

More Specific Contrasts (pyDESeq2)¶

Group¶

In [ ]:
pdata =  scflow.tl.create_pseudobulk(
    self.rna, [col_sample, col_condition, col_age],
    col_celltype, layer="counts", mode="sum")
design = f"~{col_condition} + {col_age} + {col_condition} * {col_age}"
# edgr = pt.tl.EdgeR(pdata, design=design)
pds2 = pt.tl.PyDESeq2(adata=pdata, design=design)
pds2.fit()
key_control, key_treatment = [keys[col_condition][k] for k in [
    "key_control", "key_treatment"]]
key_control_cov, key_treatment_cov = [keys[col_age][k] for k in [
    "key_control", "key_treatment"]]
sf_old = {col_condition: key_treatment, col_age: key_treatment_cov}
sf_yng = {col_condition: key_treatment, col_age: key_control_cov}
gc_old = {col_condition: key_control, col_age: key_treatment_cov}
gc_yng = {col_condition: key_control, col_age: key_control_cov}

# Spaceflight-Specific Age DEGs
spaceflight_specfic_age_degs = (pds2.cond(**sf_old) - pds2.cond(**sf_yng)) - (
    pds2.cond(**gc_old) - pds2.cond(**gc_yng))
interaction_res_df = pds2.test_contrasts(spaceflight_specfic_age_degs)
pds2.plot_volcano(interaction_res_df, log2fc_thresh=0)

# Age-Specific Spaceflight DEGs
age_specfic_sf_degs = (pds2.cond(**sf_old) - pds2.cond(**gc_old)) - (
    pds2.cond(**sf_yng) - pds2.cond(**gc_yng))
interaction_res_df2 = pds2.test_contrasts(age_specfic_sf_degs)
pds2.plot_volcano(interaction_res_df2, log2fc_thresh=0)

# Old vs. Young Spaceflight
age_sf_ix = pds2.cond(**sf_old) - pds2.cond(**sf_yng)
interaction_res_df3 = pds2.test_contrasts(age_sf_ix)
pds2.plot_volcano(interaction_res_df3, log2fc_thresh=0)

# Old vs. Young GC
age_gc_ix = pds2.cond(**gc_old) - pds2.cond(**gc_yng)
interaction_res_df4 = pds2.test_contrasts(age_gc_ix)
pds2.plot_volcano(interaction_res_df4, log2fc_thresh=0)

# SF vs. GC Old
cond_old_ix = pds2.cond(**sf_old) - pds2.cond(**gc_old)
interaction_res_df5 = pds2.test_contrasts(cond_old_ix)
pds2.plot_volcano(interaction_res_df5, log2fc_thresh=0)

# SF vs. GC Young
cond_yng_ix = pds2.cond(**sf_yng) - pds2.cond(**gc_yng)
interaction_res_df6 = pds2.test_contrasts(cond_yng_ix)
pds2.plot_volcano(interaction_res_df6, log2fc_thresh=0)

# Compare
thresh_lfc, thresh_p = 1, 0.001
sf_deg_res_df_old = interaction_res_df5[(
    interaction_res_df5.adj_p_value < thresh_p) & (
        interaction_res_df5.log_fc.abs() >= thresh_lfc)].set_index("variable")
sf_deg_res_df_yng = interaction_res_df6[(
    interaction_res_df6.adj_p_value < thresh_p) & (
        interaction_res_df6.log_fc.abs() >= thresh_lfc)].set_index("variable")
sf_deg_res = pd.concat([sf_deg_res_df_old, sf_deg_res_df_yng],
                       keys=["Old", "Young"], names=["Age Group"])
sf_deg_res.loc[:, "log_fc_abs"] = sf_deg_res.log_fc.abs()
sf_deg_res = sf_deg_res.sort_values("log_fc_abs", ascending=False)[[
    "log_fc", "adj_p_value"]].unstack(0)
print("SF DEGs in Both Young & Old: ", sf_deg_res.dropna().index.values)
print("\n\nSF DEGs in Just Young", list(sf_deg_res_df_yng.index.difference(
    sf_deg_res_df_old.index)), "\n\n")
print("SF DEGs in Just Old", list(sf_deg_res_df_old.index.difference(
    sf_deg_res_df_yng.index)), "\n\n")
sf_deg_res.replace(np.nan, "")

# Marker Set Overlap
print("Both: ", marker_gene_sets.apply(
    lambda i: set(sf_deg_res.dropna().index).intersection(set(i))).apply(
        lambda x: x if len(x) > 0 else np.nan).dropna(), "\n\n")
print("Young: ", marker_gene_sets.apply(
    lambda i: sf_deg_res_df_yng.index.difference(
        sf_deg_res_df_old.index).intersection(set(i))).apply(
        lambda x: x if len(x) > 0 else np.nan).dropna(), "\n\n")
print("Old: ", marker_gene_sets.apply(
    lambda i: sf_deg_res_df_old.index.difference(
        sf_deg_res_df_yng.index).intersection(set(i))).apply(
        lambda x: x if len(x) > 0 else np.nan).dropna(), "\n\n")

SnCs¶

Old¶
In [147]:
# Setup
design = (f"~{col_condition} + Senescent_Cell_Label + "
          f"{col_condition} * Senescent_Cell_Label")
pdata2 =  scflow.tl.create_pseudobulk(
    self.rna[self.rna.obs[col_age] == keys[col_age]["key_treatment"]], [
        col_sample, col_condition, "Senescent_Cell_Label"],
    "Senescent_Cell_Label_by_Type", layer="counts", mode="sum")
pds2_snc_old = pt.tl.PyDESeq2(adata=pdata2, design=design)
pds2_snc_old.fit()
key_control, key_treatment = [keys[col_condition][k] for k in [
    "key_control", "key_treatment"]]
key_control_cov, key_treatment_cov = "Non-Senescent", "Senescent"
sf_sc = {col_condition: key_treatment,
         "Senescent_Cell_Label": key_treatment_cov}
sf_ns = {col_condition: key_treatment,
         "Senescent_Cell_Label": key_control_cov}
gc_snc = {col_condition: key_control,
          "Senescent_Cell_Label": key_treatment_cov}
gc_ns = {col_condition: key_control, "Senescent_Cell_Label": key_control_cov}

# SnC DEGs
res_df_snc = pds2_snc_old.test_contrasts(pds2_snc_old.contrast(
    column="Senescent_Cell_Label", baseline=key_control_cov,
    group_to_compare=key_treatment_cov))
print(res_df_snc[res_df_snc.adj_p_value < 0.001].head(10))
pds2_snc_old.plot_volcano(res_df_snc, log2fc_thresh=0)

# Spaceflight-Specific SnC DEGs
spaceflight_specfic_snc_degs = (pds2_snc_old.cond(
    **sf_sc) - pds2_snc_old.cond(**sf_ns)) - (
        pds2_snc_old.cond(**gc_snc) - pds2_snc_old.cond(**gc_ns))
interaction_res_df_snc_sf = pds2_snc_old.test_contrasts(
    spaceflight_specfic_snc_degs)
print(interaction_res_df_snc_sf[
    interaction_res_df_snc_sf.adj_p_value < 0.001].head(10))
pds2_snc_old.plot_volcano(interaction_res_df_snc_sf, log2fc_thresh=0)
Fitting size factors...
... done in 0.02 seconds.

Using None as control genes, passed at DeseqDataSet initialization
Fitting dispersions...
... done in 0.70 seconds.

Fitting dispersion trend curve...
... done in 0.08 seconds.

Fitting MAP dispersions...
... done in 0.64 seconds.

Fitting LFCs...
... done in 0.64 seconds.

Calculating cook's distance...
... done in 0.03 seconds.

Replacing 37 outlier genes.

Fitting dispersions...
... done in 0.03 seconds.

Fitting MAP dispersions...
... done in 0.02 seconds.

Fitting LFCs...
... done in 0.02 seconds.

Running Wald tests...
... done in 0.42 seconds.

Log2 fold change & Wald test p-value, contrast vector: [0. 0. 1. 0.]
                      baseMean  log2FoldChange     lfcSE      stat    pvalue      padj
Xkr4                179.212479       -0.011190  0.508024 -0.022026  0.982427  0.995695
Gm37180               2.730003        0.081640  0.653310  0.124964  0.900552  0.966170
Gm37363               1.127911        0.481627  0.816977  0.589523  0.555511  0.794140
Gm1992                2.308152        0.845376  0.665170  1.270916  0.203759  0.486743
Gm38148               1.674510        0.250140  0.745442  0.335559  0.737203  0.892765
...                        ...             ...       ...       ...       ...       ...
Hccs                  2.337087        0.156308  0.384872  0.406130  0.684647  0.867528
Gm15246               2.716744        0.006002  0.398421  0.015064  0.987981  0.996809
Mid1                  8.839969       -0.285549  0.538941 -0.529833  0.596228  0.816407
Gm47283              15.537917       -0.055943  0.273288 -0.204705  0.837803  0.939912
ENSMUSG00000095041  130.039870        0.076967  0.283340  0.271642  0.785897  0.915620

[12097 rows x 6 columns]
  variable   baseMean    log_fc     lfcSE      stat       p_value   adj_p_value contrast
0   Ctnnb1  21.824530  1.817093  0.228152  7.964405  1.660204e-15  2.008349e-11     None
1   Nap1l4  15.838713  1.323793  0.175228  7.554687  4.198689e-14  2.539577e-10     None
2     Plat   6.809091  2.354012  0.319697  7.363266  1.794638e-13  7.236577e-10     None
3     Bex3  15.928398  2.256285  0.338853  6.658591  2.764655e-11  8.361009e-08     None
4      Mif  20.886258  1.914521  0.290979  6.579594  4.717338e-11  1.141313e-07     None
5    Hmgb1  23.221856  1.335376  0.210520  6.343220  2.250111e-10  4.536599e-07     None
6      Egf   2.771015  1.916097  0.326017  5.877295  4.170257e-09  7.206800e-06     None
7   Igfbp6   7.040783  3.186753  0.560197  5.688629  1.280632e-08  1.787173e-05     None
8   Igfbp4   4.873177  2.807310  0.494052  5.682213  1.329632e-08  1.787173e-05     None
9     Ctsb  57.118812  1.427001  0.254592  5.605056  2.081874e-08  2.518443e-05     None
No description has been provided for this image
Running Wald tests...
... done in 0.43 seconds.

Log2 fold change & Wald test p-value, contrast vector: [0. 0. 0. 1.]
                      baseMean  log2FoldChange     lfcSE      stat    pvalue      padj
Xkr4                179.212479       -0.463716  0.683672 -0.678272  0.497599  0.999947
Gm37180               2.730003        0.186882  0.877935  0.212865  0.831432  0.999947
Gm37363               1.127911        0.301098  1.085249  0.277446  0.781438  0.999947
Gm1992                2.308152       -0.713486  0.912579 -0.781835  0.434312  0.999947
Gm38148               1.674510        0.330969  0.991846  0.333691  0.738613  0.999947
...                        ...             ...       ...       ...       ...       ...
Hccs                  2.337087       -0.044311  0.545358 -0.081251  0.935242  0.999947
Gm15246               2.716744       -0.136966  0.579655 -0.236290  0.813208  0.999947
Mid1                  8.839969        0.059856  0.729548  0.082046  0.934610  0.999947
Gm47283              15.537917        0.289462  0.369284  0.783846  0.433130  0.999947
ENSMUSG00000095041  130.039870       -0.007400  0.381221 -0.019410  0.984514  0.999947

[12097 rows x 6 columns]
Empty DataFrame
Columns: [variable, baseMean, log_fc, lfcSE, stat, p_value, adj_p_value, contrast]
Index: []
No description has been provided for this image
Young¶
In [145]:
# Setup
design = (f"~{col_condition} + Senescent_Cell_Label + "
          f"{col_condition} * Senescent_Cell_Label")
pdata2 =  scflow.tl.create_pseudobulk(
    self.rna[self.rna.obs[col_age] == keys[col_age]["key_treatment"]], [
        col_sample, col_condition, "Senescent_Cell_Label"],
    "Senescent_Cell_Label_by_Type", layer="counts", mode="sum")
pds2_snc_yng = pt.tl.PyDESeq2(adata=pdata2, design=design)
pds2_snc_yng.fit()
key_control, key_treatment = [keys[col_condition][k] for k in [
    "key_control", "key_treatment"]]
key_control_cov, key_treatment_cov = "Non-Senescent", "Senescent"
sf_sc = {col_condition: key_treatment,
         "Senescent_Cell_Label": key_treatment_cov}
sf_ns = {col_condition: key_treatment,
         "Senescent_Cell_Label": key_control_cov}
gc_snc = {col_condition: key_control,
          "Senescent_Cell_Label": key_treatment_cov}
gc_ns = {col_condition: key_control, "Senescent_Cell_Label": key_control_cov}

# SnC DEGs
res_df_snc = pds2_snc_yng.test_contrasts(pds2_snc_yng.contrast(
    column="Senescent_Cell_Label", baseline=key_control_cov,
    group_to_compare=key_treatment_cov))
print(res_df_snc[res_df_snc.adj_p_value < 0.001].head(10))
pds2_snc_yng.plot_volcano(res_df_snc, log2fc_thresh=0)

# Spaceflight-Specific SnC DEGs
spaceflight_specfic_snc_degs = (pds2_snc_yng.cond(
    **sf_sc) - pds2_snc_yng.cond(**sf_ns)) - (
        pds2_snc_yng.cond(**gc_snc) - pds2_snc_yng.cond(**gc_ns))
interaction_res_df_snc_sf = pds2_snc_yng.test_contrasts(
    spaceflight_specfic_snc_degs)
pds2_snc_yng.plot_volcano(interaction_res_df_snc_sf, log2fc_thresh=0)
Fitting size factors...
... done in 0.02 seconds.

Using None as control genes, passed at DeseqDataSet initialization
Fitting dispersions...
... done in 0.72 seconds.

Fitting dispersion trend curve...
... done in 0.08 seconds.

Fitting MAP dispersions...
... done in 0.65 seconds.

Fitting LFCs...
... done in 1.81 seconds.

Calculating cook's distance...
... done in 0.03 seconds.

Replacing 37 outlier genes.

Fitting dispersions...
... done in 0.02 seconds.

Fitting MAP dispersions...
... done in 0.02 seconds.

Fitting LFCs...
... done in 0.02 seconds.

Running Wald tests...
... done in 0.47 seconds.

Log2 fold change & Wald test p-value, contrast vector: [0. 0. 1. 0.]
                      baseMean  log2FoldChange     lfcSE      stat    pvalue      padj
Xkr4                179.212479       -0.011190  0.508024 -0.022026  0.982427  0.995695
Gm37180               2.730003        0.081640  0.653310  0.124964  0.900552  0.966170
Gm37363               1.127911        0.481627  0.816977  0.589523  0.555511  0.794140
Gm1992                2.308152        0.845376  0.665170  1.270916  0.203759  0.486743
Gm38148               1.674510        0.250140  0.745442  0.335559  0.737203  0.892765
...                        ...             ...       ...       ...       ...       ...
Hccs                  2.337087        0.156308  0.384872  0.406130  0.684647  0.867528
Gm15246               2.716744        0.006002  0.398421  0.015064  0.987981  0.996809
Mid1                  8.839969       -0.285549  0.538941 -0.529833  0.596228  0.816407
Gm47283              15.537917       -0.055943  0.273288 -0.204705  0.837803  0.939912
ENSMUSG00000095041  130.039870        0.076967  0.283340  0.271642  0.785897  0.915620

[12097 rows x 6 columns]
  variable   baseMean    log_fc     lfcSE      stat       p_value   adj_p_value contrast
0   Ctnnb1  21.824530  1.817093  0.228152  7.964405  1.660204e-15  2.008349e-11     None
1   Nap1l4  15.838713  1.323793  0.175228  7.554687  4.198689e-14  2.539577e-10     None
2     Plat   6.809091  2.354012  0.319697  7.363266  1.794638e-13  7.236577e-10     None
3     Bex3  15.928398  2.256285  0.338853  6.658591  2.764655e-11  8.361009e-08     None
4      Mif  20.886258  1.914521  0.290979  6.579594  4.717338e-11  1.141313e-07     None
5    Hmgb1  23.221856  1.335376  0.210520  6.343220  2.250111e-10  4.536599e-07     None
6      Egf   2.771015  1.916097  0.326017  5.877295  4.170257e-09  7.206800e-06     None
7   Igfbp6   7.040783  3.186753  0.560197  5.688629  1.280632e-08  1.787173e-05     None
8   Igfbp4   4.873177  2.807310  0.494052  5.682213  1.329632e-08  1.787173e-05     None
9     Ctsb  57.118812  1.427001  0.254592  5.605056  2.081874e-08  2.518443e-05     None
No description has been provided for this image
Running Wald tests...
... done in 0.43 seconds.

Log2 fold change & Wald test p-value, contrast vector: [0. 0. 0. 1.]
                      baseMean  log2FoldChange     lfcSE      stat    pvalue      padj
Xkr4                179.212479       -0.463716  0.683672 -0.678272  0.497599  0.999947
Gm37180               2.730003        0.186882  0.877935  0.212865  0.831432  0.999947
Gm37363               1.127911        0.301098  1.085249  0.277446  0.781438  0.999947
Gm1992                2.308152       -0.713486  0.912579 -0.781835  0.434312  0.999947
Gm38148               1.674510        0.330969  0.991846  0.333691  0.738613  0.999947
...                        ...             ...       ...       ...       ...       ...
Hccs                  2.337087       -0.044311  0.545358 -0.081251  0.935242  0.999947
Gm15246               2.716744       -0.136966  0.579655 -0.236290  0.813208  0.999947
Mid1                  8.839969        0.059856  0.729548  0.082046  0.934610  0.999947
Gm47283              15.537917        0.289462  0.369284  0.783846  0.433130  0.999947
ENSMUSG00000095041  130.039870       -0.007400  0.381221 -0.019410  0.984514  0.999947

[12097 rows x 6 columns]
No description has been provided for this image

SnCs (More Permissive Threshold)¶

In [150]:
# Compare Less & More Permissive Thresholds
print("Less & More Permissive SnC Threshold: ", self.rna.obs[[
    "Senescent_Cell_Label", f"Senescent_Cell_Label_{use_metric}_{p_h}"
    ]].value_counts())
sen_lab = f"Senescent_Cell_Label_{use_metric}_{p_h}"

# Setup
design = (f"~{col_condition} + {sen_lab} + "
          f"{col_condition} * {sen_lab}")
pdata2_3 =  scflow.tl.create_pseudobulk(
    self.rna[self.rna.obs[col_age] == keys[col_age]["key_treatment"]], [
        col_sample, col_condition, sen_lab],
    col_celltype, layer="counts", mode="sum")
pds2_snc_old_3 = pt.tl.PyDESeq2(adata=pdata2_3, design=design)
pds2_snc_old_3.fit()
key_control, key_treatment = [keys[col_condition][k] for k in [
    "key_control", "key_treatment"]]
key_control_cov, key_treatment_cov = "Non-Senescent", "Senescent"
sf_sc = {col_condition: key_treatment, sen_lab: key_treatment_cov}
sf_ns = {col_condition: key_treatment, sen_lab: key_control_cov}
gc_snc = {col_condition: key_control, sen_lab: key_treatment_cov}
gc_ns = {col_condition: key_control, sen_lab: key_control_cov}

# SnC DEGs
res_df_snc_3 = pds2_snc_old_3.test_contrasts(pds2_snc_old_3.contrast(
    column=sen_lab, baseline=key_control_cov,
    group_to_compare=key_treatment_cov))
print(res_df_snc_3[res_df_snc_3.adj_p_value < 0.001].head(10))
pds2_snc_old_3.plot_volcano(res_df_snc_3, log2fc_thresh=0)

# Spaceflight-Specific SnC DEGs
spaceflight_specfic_snc_degs_3 = (pds2_snc_old_3.cond(
    **sf_sc) - pds2_snc_old_3.cond(**sf_ns)) - (
        pds2_snc_old_3.cond(**gc_snc) - pds2_snc_old_3.cond(**gc_ns))
interaction_res_df_snc_sf_3 = pds2_snc_old_3.test_contrasts(
    spaceflight_specfic_snc_degs_3)
pds2_snc_old_3.plot_volcano(interaction_res_df_snc_sf_3, log2fc_thresh=0)
Less & More Permissive SnC Threshold:  Senescent_Cell_Label  Senescent_Cell_Label_senmayo_3
Non-Senescent         Non-Senescent                     98751
                      Senescent                          2906
Senescent             Senescent                          1617
Name: count, dtype: int64
Fitting size factors...
... done in 0.02 seconds.

Using None as control genes, passed at DeseqDataSet initialization
Fitting dispersions...
... done in 0.72 seconds.

Fitting dispersion trend curve...
... done in 0.08 seconds.

Fitting MAP dispersions...
... done in 0.67 seconds.

Fitting LFCs...
... done in 0.63 seconds.

Calculating cook's distance...
... done in 0.03 seconds.

Replacing 9 outlier genes.

Fitting dispersions...
... done in 0.01 seconds.

Fitting MAP dispersions...
... done in 0.01 seconds.

Fitting LFCs...
... done in 0.01 seconds.

Running Wald tests...
... done in 0.45 seconds.

Log2 fold change & Wald test p-value, contrast vector: [0. 0. 1. 0.]
                      baseMean  log2FoldChange     lfcSE      stat    pvalue      padj
Xkr4                206.366237       -0.314513  0.460150 -0.683501  0.494290  0.855347
Gm37180               3.295234       -0.110652  0.517918 -0.213647  0.830822  0.967382
Gm37363               1.461366        0.357581  0.628605  0.568848  0.569459  0.889360
Gm1992                2.968704        0.330792  0.537530  0.615393  0.538295  0.876403
Gm38148               2.144230        0.319264  0.563897  0.566174  0.571276  0.889653
...                        ...             ...       ...       ...       ...       ...
Hccs                  3.883770       -0.121759  0.278209 -0.437653  0.661638  0.923309
Gm15246               4.511894       -0.207823  0.285125 -0.728883  0.466073  0.840147
Mid1                 15.125835       -0.211798  0.501828 -0.422052  0.672987  0.927130
Gm47283              19.752385        0.003665  0.187004  0.019600  0.984362  0.996717
ENSMUSG00000095041  169.351949        0.073776  0.218794  0.337192  0.735972  0.946349

[12097 rows x 6 columns]
  variable   baseMean    log_fc     lfcSE      stat       p_value   adj_p_value contrast
0   Ctnnb1  25.875327  1.448020  0.157995  9.164952  4.956885e-20  5.996343e-16     None
1   Nap1l4  21.637783  1.072293  0.141512  7.577385  3.525899e-14  2.132640e-10     None
2     Pigf   6.112808  1.415157  0.189655  7.461751  8.538032e-14  3.095653e-10     None
3    Hmgb1  27.509007  1.337570  0.179834  7.437819  1.023610e-13  3.095653e-10     None
4      Egf   3.539228  1.574905  0.227195  6.931958  4.150563e-12  1.004187e-08     None
5  Tubgcp2   9.734000  1.174394  0.175279  6.700138  2.082226e-11  4.198116e-08     None
6    Ptbp1   6.105108  1.601140  0.243989  6.562347  5.296738e-11  9.153519e-08     None
7   Igfbp4   6.783021  2.903719  0.448717  6.471161  9.725286e-11  1.470585e-07     None
8      Mif  25.478212  1.663531  0.268315  6.199924  5.649059e-10  7.286883e-07     None
9     Plat   7.247313  1.827339  0.295217  6.189809  6.023711e-10  7.286883e-07     None
No description has been provided for this image
Running Wald tests...
... done in 0.46 seconds.

Log2 fold change & Wald test p-value, contrast vector: [0. 0. 0. 1.]
                      baseMean  log2FoldChange     lfcSE      stat    pvalue      padj
Xkr4                206.366237       -0.063479  0.619425 -0.102480  0.918376  0.999955
Gm37180               3.295234       -0.018667  0.697859 -0.026749  0.978660  0.999955
Gm37363               1.461366       -0.147345  0.847134 -0.173934  0.861918  0.999955
Gm1992                2.968704       -0.211352  0.716743 -0.294878  0.768087  0.999955
Gm38148               2.144230       -0.352492  0.767315 -0.459383  0.645959  0.999955
...                        ...             ...       ...       ...       ...       ...
Hccs                  3.883770        0.232654  0.370701  0.627605  0.530262  0.999955
Gm15246               4.511894       -0.077720  0.397181 -0.195679  0.844861  0.999955
Mid1                 15.125835        0.220451  0.674257  0.326954  0.743702  0.999955
Gm47283              19.752385        0.147430  0.251960  0.585133  0.558458  0.999955
ENSMUSG00000095041  169.351949        0.053483  0.294483  0.181615  0.855885  0.999955

[12097 rows x 6 columns]
No description has been provided for this image

SnC GEX Profiles¶

SnC DEGs by Group¶

In [192]:
top_tx_g_snc = res_snc_grps.loc[keys[col_condition][
    "key_treatment"]].sort_values("abs_log_fc", ascending=False).index
print(res_snc_grps.unstack(0).replace(np.nan, "")[[
    "log_fc", "adj_p_value"]].loc[top_tx_g_snc])
just_sf = res_snc_grps.loc[keys[col_condition][
    "key_treatment"]].index.difference(res_snc_grps.loc[keys[
        col_condition]["key_control"]].index)
just_gc = res_snc_grps.loc[keys[col_condition][
    "key_control"]].index.difference(res_snc_grps.loc[keys[
        col_condition]["key_treatment"]].index)
print(res_snc_grps.loc[:, just_gc, :].sort_values(
    "abs_log_fc", ascending=False)[["log_fc", "adj_p_value"]], "\n\n")
res_snc_grps.loc[:, just_sf, :].sort_values(
    "abs_log_fc", ascending=False)[["log_fc", "adj_p_value"]]
self.plot(kind=["matrix"], genes=just_sf, col_celltype=col_batch,
          matrix=dict(swap_axes=True, standard_scale="var"))
                      log_fc                 adj_p_value             
Condition     Ground Control Space Flight Ground Control Space Flight
variable                                                             
Vip                 3.156433     4.289319            0.0          0.0
Slc39a12           -3.551992    -3.180457       0.000003     0.000004
Tac2                1.921187     3.066049       0.000006          0.0
Phkg1                           -2.968877                    0.000006
Acsbg1                          -2.952229                    0.000003
Nwd1               -3.290416    -2.880781       0.000002     0.000008
Nhsl1              -3.295761      -2.7655            0.0     0.000002
Lrig1                           -2.744472                         0.0
Adhfe1                          -2.726487                    0.000007
Ptgs2                            2.672912                    0.000003
Acss1               -2.24669     -2.55111       0.000006     0.000001
Pnpla7             -1.995559    -2.518648       0.000006          0.0
Irak2                           -2.447392                    0.000003
Sema4b                          -2.344446                    0.000001
Myo10                           -2.299259                    0.000001
Fosb                             2.253945                    0.000001
4930488L21Rik      -2.172608    -2.194716       0.000001     0.000001
Gpld1                           -2.172901                    0.000002
Paqr8              -2.584717    -2.076295            0.0          0.0
Rorb               -2.093526    -2.038129       0.000002     0.000005
Crot               -1.772943    -2.028285            0.0          0.0
Rcbtb2                          -2.024693                    0.000006
Trp53bp2                        -2.018176                    0.000003
Phka1              -1.800492    -2.011669       0.000001     0.000001
Tspan9             -1.543476     -1.98319       0.000007          0.0
Sat1                             -1.97296                    0.000002
Cables1                          -1.95444                    0.000001
Abhd3               -1.71809    -1.922764       0.000008          0.0
Pag1                            -1.917645                    0.000007
Egr4                             1.907752                    0.000001
Soat1                           -1.870687                         0.0
Junos                           -1.869604                    0.000008
Limk1                           -1.867847                    0.000001
Appl2               -2.20817    -1.862894            0.0          0.0
Psd2                            -1.845588                     0.00001
Slc27a1            -1.727418     -1.82927       0.000004     0.000006
Gpam                            -1.826651                    0.000004
Pitpnc1            -1.873934    -1.787914       0.000001     0.000002
Fam228b            -1.881222     -1.76545            0.0     0.000003
Cntrl              -1.584117    -1.761886       0.000001          0.0
Crlf3                           -1.755764                    0.000002
Vgf                 1.674676     1.753261       0.000001     0.000001
Hacd2              -1.731295    -1.739704            0.0          0.0
Rbm12                           -1.699022                    0.000002
Rft1                            -1.694305                    0.000006
Rnls                            -1.685472                    0.000004
St3gal4             -1.90577    -1.683557       0.000001     0.000005
Mitf               -1.558499    -1.679271            0.0          0.0
Agl                -1.720674    -1.667137            0.0     0.000001
Eps15                           -1.664543                         0.0
Slc10a7            -1.256906    -1.659341       0.000009          0.0
Aff1                            -1.657693                    0.000008
Cyfip1             -1.228227    -1.651509       0.000008          0.0
Enox2              -1.452157    -1.643267       0.000001          0.0
Igfbp4               1.74288     1.640399       0.000005     0.000003
Sfxn5              -1.894613    -1.624192            0.0     0.000009
Lims1              -1.149641    -1.619867       0.000008          0.0
Nek7                            -1.619015                    0.000001
Glud1              -1.607609    -1.614271            0.0          0.0
Stard9             -1.589535    -1.611922       0.000004     0.000001
Nfia               -1.589755    -1.611206       0.000005     0.000004
Gk                 -1.552192    -1.600816            0.0     0.000001
Golim4                          -1.594119                    0.000007
Denn2b                           -1.58493                    0.000009
Gna13              -1.648417    -1.576397       0.000001     0.000003
Adk                -1.547145      -1.5588            0.0          0.0
Dleu2               -1.32858    -1.554745       0.000005     0.000003
Etv6               -1.517564    -1.548585            0.0          0.0
Gm16759            -1.603156    -1.532369       0.000001     0.000001
Cep192                           -1.53033                         0.0
Atp7a                           -1.490834                    0.000003
Ppcdc                           -1.490009                    0.000004
Pepd                            -1.481809                    0.000002
Arhgef1                         -1.479845                    0.000001
Farp1              -1.751982    -1.471499            0.0     0.000001
Dram2                           -1.469943                    0.000001
Hdac1                            -1.46536                    0.000001
Afg1l                           -1.462639                         0.0
Hdac8              -1.656257    -1.461528            0.0          0.0
Msi2               -1.384742    -1.459267       0.000004          0.0
Zfp652                           -1.45775                         0.0
Osbpl11             -1.47349    -1.456132       0.000002     0.000003
Tank               -1.212401    -1.455025       0.000001          0.0
Ddhd1              -1.715886     -1.45401            0.0     0.000001
Aven                            -1.452047                    0.000004
Elovl5                          -1.451515                    0.000007
Foxn2                           -1.448836                    0.000008
4931406C07Rik                   -1.448177                    0.000005
Wdpcp                           -1.443782                         0.0
Mthfs              -1.425196    -1.443521       0.000005     0.000001
Frmd4a             -1.553984    -1.441329       0.000003     0.000003
Gng12              -1.470624    -1.432209       0.000008      0.00001
Hivep3             -1.442951    -1.429465       0.000001     0.000002
Usp6nl             -1.399203     -1.42689       0.000006     0.000007
Mlxip                           -1.416183                    0.000003
2610005L07Rik                   -1.416047                    0.000001
Ift140                          -1.415683                    0.000003
Pcyt1b                          -1.414975                    0.000008
Fkbp15                          -1.408662                         0.0
E2f3                            -1.395828                    0.000005
Fggy               -1.441128    -1.395322       0.000001     0.000001
Rttn               -1.415685    -1.391445       0.000001     0.000003
Bbs9                            -1.377205                         0.0
Fhit               -1.208899    -1.376201       0.000005     0.000007
Trps1              -1.504695    -1.373787            0.0     0.000002
Kdm3b                           -1.372672                         0.0
Anks1                           -1.371977                         0.0
Wdfy2              -1.587633    -1.371931            0.0     0.000002
Ptprm                           -1.367174                    0.000001
Fmn1                            -1.357201                    0.000001
Slc30a7                         -1.356308                         0.0
2700049A03Rik                   -1.354757                    0.000001
Phactr2            -1.373819    -1.353479       0.000009     0.000007
Hibch                           -1.352369                    0.000003
Pbx1               -1.372138    -1.350707       0.000003          0.0
Abcb7                            -1.34958                         0.0
Parp8              -1.096418    -1.346572       0.000003          0.0
Gab2               -1.421926     -1.34278            0.0     0.000003
Foxn3              -1.124782    -1.340366       0.000009     0.000001
Rap1a                           -1.339492                    0.000003
Zbtb20                          -1.333404                    0.000005
Tubgcp5                          -1.33181                    0.000002
Ranbp10                         -1.331549                         0.0
Macf1              -1.361563    -1.331407            0.0          0.0
Xpnpep1                         -1.330197                    0.000001
Mettl15                         -1.329575                    0.000005
Metap1d                         -1.328115                    0.000002
Phkb               -1.551834    -1.327937            0.0          0.0
Mir100hg           -1.141413    -1.324218       0.000006     0.000001
Dock4              -1.210086    -1.321161       0.000001          0.0
Arhgap12                        -1.318575                    0.000001
Bckdhb             -1.257716    -1.317004            0.0          0.0
Kiz                             -1.313942                    0.000004
Zfp182             -1.127409    -1.306316       0.000007     0.000001
Snx9               -1.293759    -1.305376       0.000001     0.000003
Atm                -1.458323    -1.305022       0.000003          0.0
Mir99ahg           -1.338685    -1.303796            0.0     0.000001
Arhgap39           -1.194132     -1.30198        0.00001     0.000001
Marf1                           -1.301696                    0.000001
Exoc2                             -1.2993                         0.0
Usp24              -1.479372    -1.298471            0.0     0.000002
Ikbkb                           -1.296711                    0.000005
Chchd3             -1.212952    -1.296071            0.0          0.0
Iffo1                           -1.292995                    0.000003
Spire1             -1.481037    -1.289635            0.0          0.0
Ets2                             1.288177                    0.000008
1110019D14Rik                   -1.287858                     0.00001
Ssh2               -1.431823    -1.281648            0.0      0.00001
Fars2              -1.233951    -1.280203            0.0          0.0
Zfp609                          -1.277499                         0.0
Rbmx                            -1.275619                    0.000009
Rsu1                            -1.274831                    0.000001
Ngly1                           -1.266358                    0.000009
Tmem260            -1.358448    -1.261991       0.000001          0.0
Mtmr3              -1.141664    -1.258729            0.0          0.0
Zhx3                            -1.257531                    0.000003
Pvt1                            -1.256151                    0.000009
Clint1                          -1.254483                         0.0
Pou2f1             -1.333633    -1.254153            0.0          0.0
Ksr1                            -1.253239                    0.000001
Dip2b              -1.209215    -1.252458       0.000002     0.000001
St3gal3            -1.180196    -1.249606       0.000006          0.0
Pphln1             -1.734731     -1.24902            0.0     0.000007
Ints6l                          -1.248422                    0.000003
Wrn                             -1.248163                    0.000003
Aatf                            -1.246979                    0.000001
Map4k4             -1.279851    -1.245586            0.0     0.000001
Peak1                           -1.242027                    0.000003
Asph                            -1.241851                    0.000008
Tbl1xr1            -1.220068    -1.241487            0.0          0.0
5430405H02Rik                   -1.240385                    0.000009
Garre1                          -1.240103                    0.000002
Acer3              -1.208879    -1.238302       0.000001     0.000002
Agps                            -1.237916                         0.0
Ide                             -1.235851                         0.0
Mbnl1              -1.408941    -1.235766            0.0     0.000009
5830417I10Rik                   -1.230097                    0.000006
Caap1                           -1.229411                         0.0
Ccdc88a            -1.389542     -1.22524            0.0          0.0
Cdin1                           -1.222015                    0.000004
Srbd1                           -1.221812                    0.000008
Nav2                            -1.218302                    0.000001
Snx29              -1.308683    -1.217001       0.000002     0.000008
Cep85l             -1.603023    -1.214891            0.0      0.00001
Gpatch2l                        -1.214858                    0.000002
Mdm4               -1.002103    -1.214431       0.000002          0.0
Nfkb1              -1.095584    -1.214374       0.000002          0.0
Vps35l             -1.227198    -1.214295       0.000002          0.0
Herc4              -1.174051    -1.212011            0.0     0.000002
Adam10                          -1.205012                         0.0
Arhgap5            -1.527251    -1.200615            0.0     0.000005
Zfp532             -1.125011    -1.200488       0.000001     0.000002
Gpatch2                         -1.200008                         0.0
Naa16              -1.193444    -1.199055       0.000003     0.000002
Mkln1              -1.084343    -1.196997            0.0          0.0
Dst                -1.075446    -1.195719            0.0          0.0
Fmnl2              -1.250118    -1.195355       0.000001     0.000004
Abl1                            -1.192791                     0.00001
Taf15              -1.114306    -1.191868            0.0          0.0
Zfp326                          -1.191233                    0.000002
Ufl1                            -1.188672                         0.0
Baz2b              -1.000806      -1.1882       0.000009          0.0
Mvb12b             -1.431369     -1.18731            0.0     0.000001
Arhgap17                        -1.187129                    0.000009
Lamp2              -1.094012    -1.186495       0.000005     0.000002
Srsf4                           -1.186111                    0.000002
Zfand6                          -1.185857                    0.000003
Cdkal1             -1.085924    -1.184648            0.0          0.0
Dennd4c                         -1.181313                    0.000009
Pias1              -1.040821    -1.179422       0.000001          0.0
Myo18a             -1.236738    -1.178149            0.0     0.000002
Fam222b            -1.103829    -1.176324       0.000008          0.0
Nfyc                            -1.174726                    0.000001
Bex3                1.353308     1.173545            0.0     0.000001
5031425E22Rik                   -1.173343                         0.0
Rspry1             -1.143806    -1.170803       0.000003          0.0
Apbb2              -1.228567    -1.169639            0.0     0.000004
Kdm3a                           -1.169541                    0.000001
Fbxl12                          -1.169216                     0.00001
Urgcp                           -1.168905                    0.000001
Raf1                            -1.167525                    0.000001
Armh3                            -1.16686                    0.000001
Zfyve1                          -1.165307                    0.000003
Ccdc58                          -1.164089                    0.000004
Pik3c2a            -1.024146    -1.163565       0.000003          0.0
Mapk14                          -1.155314                    0.000001
Wwox               -1.071801     -1.15357            0.0          0.0
Lrrfip2                         -1.152523                    0.000001
Zfp608             -1.135659    -1.151419       0.000001     0.000002
Gpbp1l1                         -1.150877                    0.000001
Cdc27                           -1.150376                    0.000001
Arid4a                          -1.150133                    0.000001
Rap1gds1           -1.118123    -1.149898       0.000002          0.0
Ptpn9                           -1.148738                    0.000001
Ralgapb                         -1.148341                    0.000001
Trim24                          -1.146034                    0.000001
Wnk1               -1.231969    -1.143889            0.0     0.000008
Chd9               -1.227761    -1.143509            0.0          0.0
Acaca              -1.286029    -1.143042            0.0     0.000005
Akap10             -1.014584    -1.142386       0.000003          0.0
Map3k3             -1.012288    -1.141479       0.000004          0.0
Rock1                           -1.139758                         0.0
Klf7               -1.119801    -1.137407       0.000001          0.0
Tbcel                           -1.137367                    0.000007
Zfp407                          -1.136468                    0.000001
Cog5                            -1.135283                         0.0
Chaserr                          -1.13249                         0.0
Itch               -1.280323    -1.132281            0.0          0.0
Dennd4a            -1.125418    -1.132054       0.000002     0.000003
Pwwp2a                           -1.13097                    0.000001
Pkd2                            -1.130946                    0.000003
Camkmt             -1.118409     -1.12973       0.000001     0.000001
Tdrd3              -1.000823    -1.128264       0.000008          0.0
Clasp2             -1.243668    -1.127981            0.0          0.0
Rb1                -1.280945     -1.12728            0.0     0.000001
Tbc1d9b                         -1.125478                    0.000007
Wwp1                            -1.125445                    0.000002
Diaph2                          -1.124863                         0.0
Prkn               -1.153864    -1.123061            0.0          0.0
Phf21a             -1.029126    -1.122967       0.000001          0.0
Prdm2                           -1.121082                    0.000001
Immp2l                          -1.119868                         0.0
Exoc4                           -1.119411                         0.0
Nt5c2                           -1.118587                    0.000001
Setd2                              -1.117                         0.0
Fus                             -1.116371                         0.0
Mia2                            -1.116298                    0.000001
Fcho2                           -1.115583                    0.000001
Orc3                            -1.112079                    0.000002
Rsrp1                           -1.111908                         0.0
Kat6b              -1.074353    -1.111771       0.000002     0.000001
Ralgps1                         -1.111629                    0.000004
Sh3kbp1                         -1.110383                     0.00001
Mtm1               -1.167992    -1.109693       0.000008     0.000005
Tmem135            -1.054575    -1.109354            0.0          0.0
Kansl1l            -1.055743    -1.109265            0.0          0.0
Gbf1                            -1.107221                         0.0
Sh3glb1                         -1.106899                    0.000001
Pbrm1                           -1.106482                         0.0
Sptlc2                          -1.106367                    0.000002
Cep170             -1.023061    -1.106086            0.0     0.000001
Ptar1                           -1.105347                    0.000006
Map3k2             -1.064533    -1.104862            0.0          0.0
Strada                          -1.102824                    0.000004
Dnaaf9              -1.36844    -1.102603            0.0     0.000002
Specc1             -1.167122    -1.102403            0.0          0.0
Lin52                           -1.102008                    0.000004
Kansl1             -1.034334    -1.098365            0.0          0.0
Abi1               -1.249959    -1.095722            0.0     0.000001
Tnrc6b             -1.089517     -1.09466            0.0          0.0
Dido1                           -1.093208                    0.000004
Mon2                             -1.09268                    0.000002
AU040320                         -1.09205                    0.000003
Cyb5r4                          -1.091985                    0.000004
Hectd1                           -1.09076                         0.0
Mfn1               -1.318819    -1.090036            0.0     0.000007
Cnnm2                           -1.088328                     0.00001
Spata5                          -1.087306                    0.000003
Dcaf8                           -1.086865                         0.0
Supt3                           -1.086731                    0.000002
Med13l                          -1.086676                         0.0
Esco1                            -1.08606                         0.0
Stx8                            -1.084876                    0.000001
Ddx17              -1.080572    -1.082997       0.000001          0.0
Atad2b             -1.212455     -1.08135            0.0          0.0
Dpy19l4                         -1.077825                    0.000003
Aftph                           -1.076983                    0.000001
Dcp1b                           -1.073342                    0.000008
Tsix               -1.065956    -1.072892       0.000003     0.000001
Xist               -1.077449    -1.072606            0.0          0.0
Epc1               -1.071946    -1.072105            0.0     0.000001
Atf7ip             -1.150905    -1.071788            0.0     0.000002
Cnot4                           -1.071681                         0.0
Rfx3                            -1.071429                    0.000007
Zup1                            -1.071179                    0.000003
Cspp1              -1.079079    -1.070968       0.000002     0.000002
Ppip5k2                         -1.070868                    0.000007
Fbxl20                          -1.070577                         0.0
Cpeb4              -1.155114    -1.069591            0.0     0.000002
Zfp277                           -1.06933                    0.000009
Ehbp1              -1.160652    -1.069179            0.0     0.000001
Eri3                            -1.069108                    0.000008
Gm21992                         -1.068347                    0.000004
Mllt10             -1.001423    -1.067855            0.0          0.0
Usp8                            -1.066508                    0.000008
Hmg20a             -1.153541    -1.066058       0.000001          0.0
Smc5               -1.160576    -1.065999       0.000005     0.000003
Ap3b1              -1.080438    -1.061902       0.000001     0.000001
Reps1                           -1.061845                    0.000005
Nsmce2             -1.147576    -1.061745            0.0          0.0
Exoc6b             -1.143799    -1.061083       0.000001     0.000004
Vps54                             -1.0609                         0.0
Fnbp4                           -1.060448                    0.000001
Zfc3h1                          -1.060356                         0.0
Phc3                            -1.060246                         0.0
Mier1               -1.02861    -1.059474       0.000001          0.0
Pik3ca                          -1.057906                    0.000001
Akt3               -1.058985    -1.057594       0.000003     0.000001
Cd2ap                           -1.054839                         0.0
Armc8              -1.033047    -1.054456       0.000009     0.000001
Tab2               -1.118642    -1.052307       0.000001     0.000004
Vti1a              -1.085728     -1.05173            0.0          0.0
D130040H23Rik      -1.200104    -1.051713       0.000007     0.000009
Tasor2                          -1.051641                    0.000002
Copg2                           -1.051164                    0.000003
Gnaq               -1.211268    -1.051124            0.0          0.0
Tut7                            -1.050976                    0.000001
Stk38                           -1.050363                    0.000003
Ambra1             -1.038843    -1.050164            0.0          0.0
Spopl              -1.041162    -1.049901       0.000008     0.000002
Ktn1               -1.093128     -1.04837            0.0          0.0
Nr3c2                           -1.047499                    0.000004
Prkdc                           -1.047373                    0.000006
Trappc8                         -1.045488                    0.000001
Zc3h7a                          -1.044699                    0.000006
Arhgef12           -1.114368    -1.043801       0.000001          0.0
Nsd1                            -1.043247                         0.0
Zfp292               -1.0377    -1.042481       0.000001          0.0
Dnajc1                          -1.042034                    0.000001
Lrch3               -1.05744    -1.041789            0.0     0.000001
Elp4               -1.158498    -1.040903            0.0     0.000002
Fam120c                         -1.040768                    0.000009
Kmt2c               -1.18665    -1.040176            0.0          0.0
Birc6                            -1.03906                         0.0
Arid1b             -1.035444    -1.039026       0.000001          0.0
Rnf216             -1.007176    -1.038781       0.000001          0.0
P4ha1                           -1.038611                    0.000002
Irf2                -1.27092     -1.03832       0.000001     0.000001
Cyrib              -1.236229    -1.037215            0.0     0.000004
Cblb                            -1.035991                    0.000002
Sfswap             -1.131248    -1.034404       0.000001     0.000001
Tmem245                         -1.032407                    0.000002
Eps15l1                         -1.031977                    0.000001
Trpm7                           -1.031837                    0.000001
Bcas3               -1.07355    -1.031474            0.0          0.0
Cdk12                           -1.031238                         0.0
Hmbox1              -1.01985    -1.030377            0.0     0.000002
Gtf2a1                          -1.030351                    0.000001
Xrcc4                           -1.030218                    0.000002
Cep350             -1.117219    -1.029798            0.0          0.0
Wdr37                           -1.029359                    0.000001
Ncoa6              -1.010685    -1.028472       0.000003     0.000007
Hdac4                           -1.027947                    0.000006
Usp40              -1.187467    -1.027877       0.000001     0.000003
Snap23                            -1.0276                    0.000009
Lnpep              -1.106193    -1.026508       0.000001     0.000003
Spag9              -1.113304    -1.026365            0.0          0.0
Rbm6                            -1.025523                         0.0
Zcchc7             -1.046159    -1.025514            0.0          0.0
Tasor              -1.116647    -1.025185            0.0          0.0
Ank2                -1.12366    -1.023358            0.0     0.000007
Rabep1             -1.145179    -1.023303            0.0     0.000001
Slc38a6                         -1.023266                    0.000009
Larp4b             -1.018161    -1.022693       0.000003          0.0
Gatad2b                         -1.022442                    0.000001
Dennd1a            -1.127119    -1.022056            0.0          0.0
Smg6                            -1.020681                         0.0
Jmjd1c             -1.126862    -1.020211            0.0          0.0
Ranbp9             -1.219734    -1.018974            0.0     0.000001
Atp11c             -1.137506     -1.01858       0.000008     0.000004
Mycbp2             -1.001901    -1.018552            0.0          0.0
Rbm33                           -1.018146                         0.0
Dop1a                           -1.017908                    0.000001
Dnm2               -1.288592    -1.017427            0.0     0.000004
Xpr1               -1.064153    -1.015013       0.000009     0.000002
Magi1              -1.254253    -1.014334            0.0          0.0
Ubac2              -1.334667     -1.01341            0.0     0.000003
Rsrc1              -1.022695    -1.011142       0.000001     0.000002
Babam2                          -1.010145                    0.000002
Atp9b              -1.002789    -1.010089       0.000001          0.0
Smyd3                            -1.00996                         0.0
Eya3                             -1.00584                    0.000006
Gpatch8             -1.05203      -1.0055       0.000001          0.0
Phip                            -1.004013                         0.0
Fam193a                         -1.004002                         0.0
Memo1                            -1.00349                    0.000001
Cep83                           -1.003376                    0.000009
Rsf1               -1.017571    -1.000922            0.0          0.0
Atxn2                           -1.000783                    0.000005
                                log_fc   adj_p_value
Condition      variable                             
Ground Control Gm6145        -3.573377  4.522636e-06
               E130114P18Rik -3.414828  3.313507e-06
               Gm12239       -2.883274  3.700958e-06
               Slc6a11       -2.790756  1.808033e-06
               Arhgef26      -2.616303  1.392169e-06
               Slc1a2        -2.577479  4.539396e-08
               Pla2g7        -2.519176  1.003768e-06
               Diaph3        -2.513137  1.672402e-06
               Igfbp6         2.477248  1.230298e-08
               Klf15         -2.404960  8.116361e-06
               Luzp2         -2.366946  7.099937e-08
               Mmd2          -2.365859  8.041800e-07
               Rapgef3       -2.362625  5.404788e-07
               Gm3764        -2.259300  4.838744e-06
               Cecr2         -2.233255  8.116361e-06
               Asrgl1        -2.208509  3.607053e-07
               Lypd6         -2.192115  3.310536e-07
               Ccn3           2.188541  2.805913e-06
               Nckap5        -2.168645  1.002755e-06
               Gm37298       -2.111420  7.769395e-06
               Maml2         -2.081038  5.691145e-07
               Gm16091       -2.025520  1.257783e-06
               Aldoc         -1.956697  4.522636e-06
               Npas3         -1.921641  6.456072e-07
               Ndrg2         -1.915704  7.229640e-06
               Tesk2         -1.880962  3.313388e-07
               Acsl3         -1.853781  9.431177e-08
               Gfra1         -1.844610  7.454419e-06
               Nim1k         -1.827430  5.526595e-06
               Oma1          -1.823862  3.084900e-06
               Sash1         -1.817687  6.596238e-08
               Arsk          -1.754333  1.094137e-06
               Ptch1         -1.737881  1.588596e-07
               Gm26618       -1.734147  1.392169e-06
               Tprkb         -1.731847  1.434050e-06
               Dtna          -1.707073  3.640761e-08
               Stambpl1      -1.706047  2.739354e-06
               Sec23ip       -1.705224  1.553295e-07
               Zfpm2         -1.703982  1.120658e-06
               Ugp2          -1.676430  1.081473e-07
               Tsc22d4       -1.661644  3.822588e-06
               B930095G15Rik -1.656557  6.488290e-06
               Dhtkd1        -1.627498  6.759036e-07
               Myo6          -1.624461  4.587572e-06
               Pik3r1        -1.617184  6.994977e-08
               Chn2          -1.596501  4.218427e-06
               Pcx           -1.587668  3.110172e-06
               Tmem243       -1.574139  3.586349e-07
               Mtmr10        -1.572795  2.564116e-06
               Lifr          -1.571746  2.003774e-06
               Nfib          -1.566654  6.862877e-07
               Slc8a1        -1.561550  1.629545e-06
               Slc9a9        -1.557398  5.662713e-06
               Ivd           -1.557192  5.095237e-07
               Ccdc62        -1.554425  7.804236e-06
               Pcdh11x       -1.554361  3.774851e-06
               Ccdc93        -1.545851  5.340672e-06
               Sema6d        -1.534389  5.231307e-07
               Trub2         -1.525946  1.340431e-06
               Pot1b         -1.513722  4.587572e-06
               Map2k6        -1.512163  4.713405e-06
               Pcdh9         -1.502747  3.590799e-06
               Scfd2         -1.480469  3.981344e-08
               Nsdhl         -1.474669  8.777911e-06
               Camk2g        -1.456779  5.662713e-06
               Gpd2          -1.452743  6.448043e-06
               Washc2        -1.451305  9.917344e-08
               Septin7       -1.449975  5.370576e-06
               Tmtc2         -1.448533  1.059784e-06
               Ccdc50        -1.447676  1.430946e-07
               Hivep1        -1.443925  9.760159e-07
               Abr           -1.443667  1.322976e-06
               Cdh10         -1.439354  7.904395e-07
               Gm4258        -1.439126  7.737143e-06
               Zfp236        -1.426366  3.757451e-08
               Arhgap35      -1.417262  6.880635e-08
               Ppp2r5a       -1.408267  2.519228e-06
               Tmcc3         -1.406169  8.450970e-06
               Wbp1l         -1.404148  7.488597e-07
               Rhobtb3       -1.402055  7.947613e-07
               2610035D17Rik -1.401872  5.703400e-06
               Itgav         -1.400945  5.465919e-06
               Mgll          -1.400018  1.434050e-06
               Asap2         -1.389618  5.223541e-06
               Neo1          -1.380654  6.330896e-08
               Creb1         -1.379590  7.357258e-08
               Ice2          -1.372636  1.470231e-06
               Cwf19l2       -1.371062  2.766886e-08
               Hip1          -1.366718  8.450970e-06
               Atxn7l1       -1.366285  6.736806e-07
               Peli2         -1.364201  5.313785e-06
               Rab8b         -1.358611  3.813238e-06
               Cc2d2a        -1.350325  3.278794e-06
               Utp25         -1.346449  5.675781e-06
               Prkca         -1.342159  7.505257e-08
               Dlc1          -1.340733  5.587188e-07
               Gak           -1.340573  4.587572e-06
               Itprid2       -1.332288  7.020289e-06
               Rnf146        -1.330196  4.960780e-06
               C230086J09Rik -1.329386  7.288469e-06
               Cadm1         -1.328480  7.454080e-08
               Rnf13         -1.322202  6.388942e-06
               Unk           -1.317669  2.148272e-06
               Cdh2          -1.316369  4.067037e-06
               Itsn1         -1.315967  1.536148e-06
               Pola1         -1.315773  3.726800e-06
               Rab10         -1.307995  7.988646e-09
               Arhgef11      -1.307824  1.081473e-07
               Daam1         -1.302063  5.268467e-06
               Apc           -1.298690  1.369047e-08
               Ptprj         -1.296744  3.187535e-06
               Ncam1         -1.296248  4.800711e-06
               Naaladl2      -1.294446  1.200129e-06
               Washc4        -1.294124  3.472633e-07
               Mgat5         -1.292674  5.612012e-06
               Slk           -1.290791  1.808033e-06
               Mtss1         -1.288529  3.700958e-06
               Mef2a         -1.287439  4.902157e-06
               Bach2         -1.282681  7.505257e-08
               Rasa3         -1.280034  8.300246e-06
               Wdr70         -1.277005  2.564096e-07
               B3galt1       -1.267652  8.832137e-06
               Sema4d        -1.263339  8.463073e-06
               Fbxl4         -1.262910  2.805913e-06
               Desi2         -1.262064  3.065979e-07
               Rasa2         -1.259666  2.521782e-06
               Fam172a       -1.258529  6.462928e-09
               Gnao1         -1.257994  7.983537e-06
               Ppp6r2        -1.257855  6.862877e-07
               Slc25a12      -1.256374  4.220338e-08
               Cnot1         -1.255686  2.890293e-07
               Ammecr1l      -1.255162  9.823754e-06
               Hltf          -1.245190  5.159067e-06
               Kif1b         -1.237999  1.127198e-07
               B230307C23Rik -1.233874  9.530974e-06
               Wdr20         -1.232362  7.121293e-06
               Naa35         -1.229264  4.902157e-06
               Pikfyve       -1.226793  3.131608e-07
               Mat2a         -1.217237  4.185987e-07
               Numb          -1.213336  6.565357e-06
               Spred1        -1.205513  4.862312e-08
               Wsb1          -1.204608  8.727139e-07
               Oxr1          -1.204481  2.324424e-06
               Wdr44         -1.204101  3.705113e-06
               Cdc42se2      -1.203274  1.200129e-06
               Kdm4c         -1.203249  2.349564e-07
               Gphn          -1.200420  2.479579e-07
               Chpt1         -1.200016  2.076011e-06
               Crtc3         -1.196631  2.635534e-06
               Ankib1        -1.195997  4.397423e-07
               Tmcc1         -1.192550  2.349564e-07
               Phactr3       -1.185863  9.340727e-06
               Slain2        -1.184776  6.448043e-06
               Atp2c1        -1.183071  8.613809e-08
               Pan3          -1.182425  2.663665e-08
               Extl3         -1.180863  6.818509e-06
               Smarca2       -1.180437  7.454080e-08
               Btbd3         -1.180249  9.261294e-06
               Prpf39        -1.178642  1.823962e-07
               Tanc2         -1.176917  8.176494e-06
               Csnk2a1       -1.175128  1.340431e-06
               Nlk           -1.173702  2.324424e-06
               Galnt2        -1.173301  5.223541e-06
               Wapl          -1.171429  1.459814e-07
               Cnot2         -1.170786  2.871885e-08
               Marchf2       -1.168860  8.037853e-06
               Rc3h1         -1.166094  8.758108e-08
               Scaper        -1.164729  1.205154e-06
               Huwe1         -1.164458  1.127198e-07
               Eif4g3        -1.159608  7.988646e-09
               9330159F19Rik -1.158959  7.004815e-06
               Pigu          -1.154961  4.329854e-06
               Zfyve16       -1.153574  6.761511e-06
               Mcu           -1.146269  6.421886e-06
               Syncrip       -1.145057  4.500749e-06
               Tcf4          -1.143223  1.392169e-06
               Fryl          -1.143214  6.410202e-07
               Senp1         -1.140985  9.340727e-06
               Cpeb2         -1.137233  2.076011e-06
               Zfp638        -1.135153  4.428509e-08
               Psd3          -1.133795  2.932375e-07
               Actr2         -1.133172  4.587572e-06
               Kat6a         -1.130519  8.970757e-07
               Zfp106        -1.128510  7.347406e-06
               Hnrnpa2b1     -1.127334  3.065979e-07
               Zfand3        -1.126955  1.588596e-07
               Arid1a        -1.124097  7.864408e-07
               Akap7         -1.123973  5.268467e-06
               Jarid2        -1.123364  3.607190e-08
               Peli1         -1.121964  1.801566e-06
               Ppp4r1        -1.121127  5.379300e-06
               N4bp2l2       -1.119830  3.681293e-07
               Git2          -1.119562  7.965338e-06
               Vps50         -1.118761  4.218427e-06
               Fip1l1        -1.118132  3.525986e-07
               Galnt1        -1.117342  7.638523e-07
               Top2b         -1.116615  1.454133e-06
               Gtdc1         -1.114814  2.329193e-07
               Nf1           -1.114517  1.492420e-09
               Morc2a        -1.111535  9.530974e-06
               AW554918      -1.110554  8.470382e-08
               Asxl2         -1.109968  1.337326e-07
               Map4          -1.108524  1.300559e-06
               Rif1          -1.106647  4.344484e-06
               Cask          -1.103665  3.387730e-06
               Ckap5         -1.103639  5.231307e-07
               Depdc5        -1.103416  9.114696e-06
               Uimc1         -1.102979  5.465919e-06
               Vps13d        -1.102420  3.150288e-07
               Zmym4         -1.101603  4.380189e-08
               Tlk2          -1.098283  3.313388e-07
               Sgce          -1.096091  1.635591e-06
               Rasa1         -1.095814  2.560153e-07
               Nrf1          -1.095478  4.397423e-07
               Nr3c1         -1.095468  6.880635e-08
               Ncor1         -1.093589  1.043336e-08
               Ehmt1         -1.093530  1.983920e-06
               Ubn1          -1.091978  5.268467e-06
               Kdm6a         -1.088983  9.159620e-08
               Kpna3         -1.088624  4.587572e-06
               Tsc22d2       -1.085540  8.118987e-07
               Btbd7         -1.084467  4.209651e-07
               Ubr3          -1.083015  1.316637e-08
               Cux1          -1.082372  8.925063e-06
               Phf14         -1.082359  6.507224e-07
               Cbl           -1.081227  6.343860e-06
               Rab12         -1.079538  7.911894e-06
               Malat1        -1.079456  2.678250e-06
               Asap1         -1.078946  8.345314e-07
               E130307A14Rik -1.076968  3.785909e-06
               Sik3          -1.075276  5.282842e-06
               Brwd3         -1.071343  4.925441e-06
               Megf9         -1.069265  6.755278e-06
               Lrba          -1.068716  1.628891e-06
               Rnf130        -1.068456  1.138995e-06
               4732471J01Rik -1.068404  4.630704e-06
               Mysm1         -1.066166  4.688774e-06
               Cop1          -1.065041  5.806975e-07
               Smurf2        -1.061977  1.445069e-07
               Arfgef1       -1.061893  4.352756e-07
               Ubr1          -1.061293  8.391277e-07
               St7l          -1.058720  2.452596e-06
               Ppm1b         -1.058635  1.220624e-06
               Gapvd1        -1.058337  7.593985e-07
               Herc1         -1.058221  8.815958e-07
               Dmtf1         -1.058108  6.753267e-06
               Arid2         -1.055463  3.472633e-07
               Rbm25         -1.052244  2.755831e-09
               Nr1d2         -1.051903  4.960780e-06
               Ric1          -1.051242  5.582738e-06
               Sdccag8       -1.050709  1.918954e-06
               Abcc5         -1.050198  4.932853e-07
               Psme4         -1.048667  3.954945e-07
               Pias2         -1.048530  3.672693e-06
               Dennd5a       -1.048221  1.966510e-06
               Rbm26         -1.048027  1.316286e-07
               Wdfy3         -1.046912  2.167377e-08
               Spast         -1.046348  4.751415e-06
               Ext1          -1.045646  5.178671e-06
               Dyrk1a        -1.044700  3.345228e-07
               Pcm1          -1.043335  4.491349e-07
               Gigyf2        -1.042536  2.441935e-07
               Gm49797       -1.041415  9.068360e-06
               Fbxo38        -1.040840  1.392122e-06
               Rere          -1.038889  4.429356e-08
               Nfat5         -1.038691  5.631573e-07
               Marchf7       -1.038086  1.434050e-06
               Herc2         -1.036836  4.932853e-07
               Arid4b        -1.036753  6.862877e-07
               Wac           -1.035655  1.381108e-06
               Ncoa2         -1.035562  8.863695e-07
               Specc1l       -1.034861  1.263371e-06
               Atrx          -1.033631  8.949020e-08
               Ppp6r3        -1.031682  3.091924e-06
               Ago3          -1.029933  3.310284e-07
               Epc2          -1.028556  8.832137e-06
               Stk3          -1.028305  7.244439e-06
               Trip11        -1.027546  2.893612e-06
               U2surp        -1.027529  1.015861e-06
               Uvrag         -1.025144  3.700958e-06
               Slc25a36      -1.024973  4.925441e-06
               Ccnt2         -1.024334  4.751415e-06
               Faf1          -1.023775  1.297364e-06
               Tmem165       -1.022415  9.268712e-06
               Rhot1         -1.021899  7.804236e-06
               Dcaf6         -1.021678  7.244439e-06
               Xrn2          -1.021641  5.477727e-06
               Ints6         -1.020837  3.374238e-06
               Insr          -1.019854  7.904395e-07
               Nipbl         -1.019622  7.988646e-09
               Slc38a9       -1.019436  1.340431e-06
               Thrap3        -1.019224  2.242012e-06
               Ppp1r12a      -1.018894  9.431177e-08
               Tjp1          -1.018081  1.055035e-06
               Pten          -1.015087  6.152049e-07
               Relch         -1.014096  5.343400e-06
               Npepps        -1.014025  2.324424e-06
               Map2k5        -1.014022  1.115852e-06
               Chd6          -1.011588  5.134139e-08
               Pafah1b1      -1.009340  2.349564e-07
               Camsap2       -1.008730  6.268956e-06
               Tra2a         -1.007333  9.431177e-08
               Rbm39         -1.005894  8.222625e-09
               Son           -1.005566  1.588596e-07
               Smg7          -1.004829  7.801740e-07
               Zkscan3       -1.003514  3.187535e-06
               Pum1          -1.003214  3.532630e-06
               Pabpn1        -1.002490  7.801740e-07
               Setd5         -1.001812  7.454080e-08
               Fto           -1.001111  4.587572e-06
               Rbm5          -1.000905  1.258620e-07
               Aff4          -1.000789  5.675781e-06
               Numa1         -1.000670  3.625730e-06
               Usp34         -1.000268  7.818954e-07
               Sesn1         -1.000007  2.651364e-06 


Out[192]:
log_fc adj_p_value
Condition variable
Space Flight Phkg1 -2.968877 5.854433e-06
Acsbg1 -2.952229 3.453443e-06
Lrig1 -2.744472 4.315019e-07
Adhfe1 -2.726487 7.208347e-06
Ptgs2 2.672912 2.804616e-06
Irak2 -2.447392 2.719703e-06
Sema4b -2.344446 1.122562e-06
Myo10 -2.299259 5.832356e-07
Fosb 2.253945 5.213249e-07
Gpld1 -2.172901 1.756315e-06
Rcbtb2 -2.024693 6.486410e-06
Trp53bp2 -2.018176 3.016868e-06
Sat1 -1.972960 1.991226e-06
Cables1 -1.954440 1.181741e-06
Pag1 -1.917645 6.822238e-06
Egr4 1.907752 1.420553e-06
Soat1 -1.870687 9.563059e-08
Junos -1.869604 8.063751e-06
Limk1 -1.867847 9.040912e-07
Psd2 -1.845588 9.937513e-06
Gpam -1.826651 3.533198e-06
Crlf3 -1.755764 1.766446e-06
Rbm12 -1.699022 2.290756e-06
Rft1 -1.694305 5.572557e-06
Rnls -1.685472 4.466070e-06
Eps15 -1.664543 3.229966e-07
Aff1 -1.657693 7.870402e-06
Nek7 -1.619015 7.780528e-07
Golim4 -1.594119 6.532917e-06
Denn2b -1.584930 9.141516e-06
Cep192 -1.530330 1.569122e-07
Atp7a -1.490834 2.780767e-06
Ppcdc -1.490009 4.066629e-06
Pepd -1.481809 2.403473e-06
Arhgef1 -1.479845 5.720882e-07
Dram2 -1.469943 1.327139e-06
Hdac1 -1.465360 1.146259e-06
Afg1l -1.462639 9.877643e-08
Zfp652 -1.457750 1.856272e-07
Aven -1.452047 3.623400e-06
Elovl5 -1.451515 7.309966e-06
Foxn2 -1.448836 8.204402e-06
4931406C07Rik -1.448177 4.694189e-06
Wdpcp -1.443782 3.794296e-08
Mlxip -1.416183 3.393277e-06
2610005L07Rik -1.416047 1.024364e-06
Ift140 -1.415683 2.627021e-06
Pcyt1b -1.414975 8.170542e-06
Fkbp15 -1.408662 9.665160e-08
E2f3 -1.395828 4.763160e-06
Bbs9 -1.377205 2.101987e-07
Kdm3b -1.372672 5.711425e-09
Anks1 -1.371977 2.261408e-07
Ptprm -1.367174 9.733288e-07
Fmn1 -1.357201 5.213769e-07
Slc30a7 -1.356308 3.438518e-07
2700049A03Rik -1.354757 5.754686e-07
Hibch -1.352369 2.563184e-06
Abcb7 -1.349580 3.010942e-07
Rap1a -1.339492 2.886735e-06
Zbtb20 -1.333404 4.539859e-06
Tubgcp5 -1.331810 2.179234e-06
Ranbp10 -1.331549 4.464255e-07
Xpnpep1 -1.330197 6.846016e-07
Mettl15 -1.329575 4.539668e-06
Metap1d -1.328115 2.054064e-06
Arhgap12 -1.318575 5.014013e-07
Kiz -1.313942 3.708510e-06
Marf1 -1.301696 5.420371e-07
Exoc2 -1.299300 1.233345e-07
Ikbkb -1.296711 4.609626e-06
Iffo1 -1.292995 2.563184e-06
Ets2 1.288177 7.924873e-06
1110019D14Rik -1.287858 9.937513e-06
Zfp609 -1.277499 1.567009e-09
Rbmx -1.275619 8.547310e-06
Rsu1 -1.274831 5.041942e-07
Ngly1 -1.266358 8.541865e-06
Zhx3 -1.257531 2.961799e-06
Pvt1 -1.256151 9.284601e-06
Clint1 -1.254483 2.261408e-07
Ksr1 -1.253239 9.040912e-07
Ints6l -1.248422 2.563184e-06
Wrn -1.248163 2.749622e-06
Aatf -1.246979 5.577270e-07
Peak1 -1.242027 3.000661e-06
Asph -1.241851 7.861102e-06
5430405H02Rik -1.240385 9.284601e-06
Garre1 -1.240103 2.074677e-06
Agps -1.237916 4.975544e-08
Ide -1.235851 3.518704e-07
5830417I10Rik -1.230097 6.251043e-06
Caap1 -1.229411 2.302285e-07
Cdin1 -1.222015 3.565152e-06
Srbd1 -1.221812 8.204402e-06
Nav2 -1.218302 1.324619e-06
Gpatch2l -1.214858 1.735987e-06
Adam10 -1.205012 6.268891e-08
Gpatch2 -1.200008 3.981031e-07
Abl1 -1.192791 9.789789e-06
Zfp326 -1.191233 1.592409e-06
Ufl1 -1.188672 4.485614e-07
Arhgap17 -1.187129 8.868777e-06
Srsf4 -1.186111 1.675275e-06
Zfand6 -1.185857 2.515842e-06
Dennd4c -1.181313 9.144167e-06
Nfyc -1.174726 1.484249e-06
5031425E22Rik -1.173343 9.142845e-08
Kdm3a -1.169541 5.213769e-07
Fbxl12 -1.169216 9.575757e-06
Urgcp -1.168905 7.902936e-07
Raf1 -1.167525 7.378319e-07
Armh3 -1.166860 1.422403e-06
Zfyve1 -1.165307 2.627021e-06
Ccdc58 -1.164089 4.388845e-06
Mapk14 -1.155314 1.420183e-06
Lrrfip2 -1.152523 1.177683e-06
Gpbp1l1 -1.150877 1.347075e-06
Cdc27 -1.150376 9.835313e-07
Arid4a -1.150133 5.041942e-07
Ptpn9 -1.148738 1.120308e-06
Ralgapb -1.148341 7.119410e-07
Trim24 -1.146034 1.425088e-06
Rock1 -1.139758 4.958736e-10
Tbcel -1.137367 6.591810e-06
Zfp407 -1.136468 9.173403e-07
Cog5 -1.135283 1.471647e-07
Chaserr -1.132490 6.784289e-08
Pwwp2a -1.130970 6.022605e-07
Pkd2 -1.130946 2.804616e-06
Tbc1d9b -1.125478 6.923577e-06
Wwp1 -1.125445 2.402106e-06
Diaph2 -1.124863 2.399381e-07
Prdm2 -1.121082 1.039890e-06
Immp2l -1.119868 3.287548e-07
Exoc4 -1.119411 4.958736e-10
Nt5c2 -1.118587 1.296364e-06
Setd2 -1.117000 2.230443e-07
Fus -1.116371 2.099518e-08
Mia2 -1.116298 1.296364e-06
Fcho2 -1.115583 6.869002e-07
Orc3 -1.112079 2.056612e-06
Rsrp1 -1.111908 3.303286e-07
Ralgps1 -1.111629 4.095232e-06
Sh3kbp1 -1.110383 9.982637e-06
Gbf1 -1.107221 1.188586e-08
Sh3glb1 -1.106899 1.224946e-06
Pbrm1 -1.106482 8.870380e-08
Sptlc2 -1.106367 1.566858e-06
Ptar1 -1.105347 5.704473e-06
Strada -1.102824 4.279465e-06
Lin52 -1.102008 3.709172e-06
Dido1 -1.093208 4.095232e-06
Mon2 -1.092680 1.819408e-06
AU040320 -1.092050 2.841975e-06
Cyb5r4 -1.091985 3.791495e-06
Hectd1 -1.090760 5.728092e-08
Cnnm2 -1.088328 9.937513e-06
Spata5 -1.087306 3.478038e-06
Dcaf8 -1.086865 1.558715e-07
Supt3 -1.086731 1.819408e-06
Med13l -1.086676 3.794296e-08
Esco1 -1.086060 3.416309e-07
Stx8 -1.084876 5.787064e-07
Dpy19l4 -1.077825 3.228678e-06
Aftph -1.076983 1.420183e-06
Dcp1b -1.073342 7.589923e-06
Cnot4 -1.071681 1.036173e-08
Rfx3 -1.071429 6.654514e-06
Zup1 -1.071179 3.296595e-06
Ppip5k2 -1.070868 6.607341e-06
Fbxl20 -1.070577 3.728932e-08
Zfp277 -1.069330 8.547457e-06
Eri3 -1.069108 8.204402e-06
Gm21992 -1.068347 4.466946e-06
Usp8 -1.066508 7.869947e-06
Reps1 -1.061845 4.554991e-06
Vps54 -1.060900 1.994828e-07
Fnbp4 -1.060448 5.123507e-07
Zfc3h1 -1.060356 4.853515e-08
Phc3 -1.060246 3.585068e-07
Pik3ca -1.057906 7.946576e-07
Cd2ap -1.054839 4.464255e-07
Tasor2 -1.051641 1.766446e-06
Copg2 -1.051164 2.780378e-06
Tut7 -1.050976 9.583436e-07
Stk38 -1.050363 2.680057e-06
Nr3c2 -1.047499 3.511396e-06
Prkdc -1.047373 6.327339e-06
Trappc8 -1.045488 1.181741e-06
Zc3h7a -1.044699 5.639096e-06
Nsd1 -1.043247 1.302321e-09
Dnajc1 -1.042034 5.303390e-07
Fam120c -1.040768 9.441782e-06
Birc6 -1.039060 4.958736e-10
P4ha1 -1.038611 2.297349e-06
Cblb -1.035991 2.484853e-06
Tmem245 -1.032407 2.057869e-06
Eps15l1 -1.031977 1.414918e-06
Trpm7 -1.031837 1.089956e-06
Cdk12 -1.031238 7.209359e-08
Gtf2a1 -1.030351 1.242729e-06
Xrcc4 -1.030218 2.037547e-06
Wdr37 -1.029359 1.484249e-06
Hdac4 -1.027947 6.363889e-06
Snap23 -1.027600 8.660642e-06
Rbm6 -1.025523 7.694457e-09
Slc38a6 -1.023266 8.872769e-06
Gatad2b -1.022442 5.213249e-07
Smg6 -1.020681 4.109565e-08
Rbm33 -1.018146 8.506466e-08
Dop1a -1.017908 8.620697e-07
Babam2 -1.010145 1.534145e-06
Smyd3 -1.009960 2.603839e-07
Eya3 -1.005840 5.785732e-06
Phip -1.004013 9.695621e-08
Fam193a -1.004002 6.766003e-08
Memo1 -1.003490 1.280211e-06
Cep83 -1.003376 8.660642e-06
Atxn2 -1.000783 4.694189e-06

Find Top Senescence Genes by Cell Type¶

Among cells in top x% of senescence scores

In [ ]:
# Overall
# mean_expr = np.asarray(self.rna[self.rna.obs["Senescence_CellType"].isin(
#     high_sen_cts)][:, genes].X.mean(axis=0)).ravel()
# df_expr = pd.DataFrame({"gene": genes, "mean_expression": mean_expr})
# df_expr = df_expr.sort_values("mean_expression", ascending=False)
# top_genes = df_expr["gene"].iloc[:10]
# df_expr.T

# Top 10 for Each Cell Type
genes_valid = [g for g in genes if g in self.rna.var_names]
rna_subset = self.rna[self.rna.obs["Senescent_Cell"].isin([1, True])]
expr_subset = rna_subset[:, genes_valid].X
expr_matrix = expr_subset.toarray() if issparse(
    expr_subset) else expr_subset  # robust sparse-to-dense
df_expr = pd.DataFrame(expr_matrix, columns=genes_valid)
df_expr.loc[:, col_celltype] = rna_subset.obs[col_celltype].values
top_genes = df_expr.groupby(col_celltype).mean(numeric_only=True).apply(
    lambda x: x.sort_values(ascending=False).head(10).index.tolist(), axis=1)
top_genes_dict = dict(top_genes)
top_genes = list(np.unique(top_genes.explode()))
print(top_genes_dict)
# print("\n\n", self.rna.obs[col_celltype].unique())
# np.array([x in self.rna.obs[col_celltype].values for x in top_genes_dict])

Query Literature, Atlases, & Pathways¶

In [ ]:
results_toppgene = scflow.pp.annotate_by_toppgene(
    top_genes_dict, species=species, min_genes=2,
    categories=["Pathway", "PubMed"])
restg = results_toppgene.Name.sort_values().reset_index(
    "Category", drop=True).reset_index("ID").groupby(
        "Gene Set").apply(lambda x: x.drop("ID", axis=1).assign(
            ID=np.arange(len(x))), include_groups=False).set_index(
                "ID", append=True).reset_index(0, drop=True).unstack("ID")
all_labels_litpath = restg.stack().Name.unique()
restg = restg.apply(lambda x: pd.Series(dict(zip(all_labels_litpath, ["x" if (
    i in list(x.Name)) else "" for i in all_labels_litpath]))), axis=1).T
print(results_toppgene[["Name", "Symbols"]])
restg

Plot¶

In [ ]:
# Top 10 Senescence Genes or All?
ggg = top_genes
# ggg = genes

# Mask for High Senescence Subset & Helper Variable for Figure Dimensions
subset = self.rna.obs["Senescent_Cell"].isin([1, True])
num_cts = len(self.rna[subset].obs[col_celltype].unique())

# Plot SnC Markers Overlap with Marker Sets
sc.pl.violin(self.rna[subset], set(genes).intersection(
    marker_gene_sets.explode().unique()),
             groupby=col_batch, rotation=90)  # plot overlap w/ SnC markers

# Plot Most Highly-Expressed Genes in Each Senescent Cell Type
_ = self.plot(kind=["matrix", "heat"], genes=top_genes,
              col_celltype=col_celltype, layer="log1p",
              subset=subset, dendrogram=True, swap_axes=False, heat=dict(
                  dendrogram=False), standard_scale="var",
              figsize=(len(top_genes) / 1.5, num_cts * 1.5))

# Grouped by Top Cell Types
_ = self.plot(kind=["matrix", "heat"], genes=top_genes_dict,
              standard_scale="obs", col_celltype=col_celltype,
              layer="log1p", swap_axes=False, figsize=(len(ggg), num_cts),
              subset=subset, dendrogram=True)

Write Object¶

In [ ]:
# Send Email with Output When Done
if email is not None and html_out is not None:
    os.system(f"jupyter nbconvert --to html {cur_file}")
    os.system(f"echo 'yay' | mutt -s 'JOB DONE' -a {html_out} -- {email}")

if overwrite is True or os.path.exists() is False:
    self.rna.write_h5ad(file_path_new)
else:
    print(f"\n\n\n{'=' * 120}\nOVERWRITE IS FALSE..."
          f"NOT WRITING OBJECT!!!\n{'=' * 120}\n\n\n")
[NbConvertApp] Converting notebook /home/easlinger/AWG/ADBR/senescence/analyze_senescence_celltype_specific_threshold.ipynb to html
[NbConvertApp] WARNING | Alternative text is missing on 102 image(s).
[NbConvertApp] Writing 16535612 bytes to /home/easlinger/AWG/ADBR/senescence/analyze_senescence_celltype_specific_threshold.html
Authenticating (PLAIN)...
Closing connection to imap.gmail.com...

SCRATCH¶

In [235]:
# df_degs = out_edgr_old_sf_v_gc.copy()
df_degs = out_edgr_batches_snc_top.copy()
# df_degs = res_snc_grps.copy()

# factor_name = col_celltype
factor_name = col_condition

names = gp.get_library_name()
# [i for i in names if "brain" in i.lower() or "mouse" in i.lower()]
pathways_snc_vs_no, res_pathways_snc_vs_no = {}, {}
thresh_p_path = 0.05
# perts_geo = ["Aging", "Drug", "Disease"]
perts_geo = ["Aging", "Disease"]
other_sets = ["GTEx_Aging_Signatures_2021", f"HDSigDB_{species}_2021",
              # "DGIdb_Drug_Targets_2024",
              "MSigDB_Hallmark_2020",
              "MSigDB_Oncogenic_Signatures", "OMIM_Disease",
              # "Reactome_Pathways_2024", "Reactome_2022",
              f"WikiPathways_2024_{species}", f"WikiPathways_2019_{species}"]
other_sets += [i for i in names if "GO_Biological_Process" in i]
# if species.lower() == "mouse":
#     other_sets += ["PerturbAtlas_MouseGenePerturbationSigs"]
for x in df_degs.reset_index()[factor_name].unique():
    pathways_snc_vs_no[x], res_pathways_snc_vs_no[x] = {}, {}
    for i in ["up", "down"]:
        degs_tmp = df_degs.loc[x]
        if i == "up":
            degs_tmp = list(degs_tmp[degs_tmp.log_fc > 0].index.values)
        else:
            degs_tmp = list(degs_tmp[degs_tmp.log_fc < 0].index.values)
        if len(degs_tmp) > 0:
            g_s = [f"{u}_Perturbations_from_GEO_{i}" for u in perts_geo] + [
                f"Disease_Signatures_from_GEO_{i}_2014"] + other_sets
            g_s = [g for g in g_s if g in names]
            pathways_snc_vs_no[x][i] = gp.enrichr(
                gene_list=degs_tmp, gene_sets=g_s,
                organism=species, cutoff=0.5)
            res_pathways_snc_vs_no[x][i] = pathways_snc_vs_no[x][i].results[
                pathways_snc_vs_no[x][i].results[
                    "Adjusted P-value"] < thresh_p_path]
    res_pathways_snc_vs_no[x] = pd.concat(res_pathways_snc_vs_no[x],
                                          names=["Direction"])
res_pathways_snc_vs_no = pd.concat(res_pathways_snc_vs_no,
                                   names=[col_celltype])
res_pathways_snc_vs_no.loc[
    :, "Term Short"] = res_pathways_snc_vs_no.Term.apply(
        lambda x: re.sub("Expression Of ", "", re.sub(".*.xls", "", re.sub(
            ".*.XLSX", "",
            re.sub(".*Supplementary Table [0-9]+[-]?", "", re.sub(
                ".*.xlsx.", "", re.sub(".*Supplementary Data ..", "", re.sub(
                    "PMID([0-9])+", "", re.sub(
                        "([0-9]+) years v ([0-9]+) years", "\\1 v \\2 yrs.",
                        re.sub("aging:([0-9]+)", "aging", re.sub(
                            "([0-9]+) months v ([0-9]+) mo(nths)?",
                            "\\1 v \\2 mo.", re.sub("SRP[0-9]+ ", "", re.sub(
                                "GSE[0-9]+ ", "", x)))))))))))))
cts_i = res_pathways_snc_vs_no.reset_index()[col_celltype].unique()
res_pathways_snc_top_vs_no = res_pathways_snc_vs_no.reset_index().groupby([
    col_celltype, "Direction"]).apply(lambda x: x.sort_values(
        "Adjusted P-value", ascending=True).head(10), include_groups=False)
fig, axes = plt.subplots(*scflow.pl.square_grid(cts_i), figsize=(
    20, 25), gridspec_kw=dict(wspace=1.5, top=0.95), squeeze=False)
for i, x in enumerate(cts_i):
    gp.dotplot(
        res_pathways_snc_top_vs_no.loc[x].reset_index(),
        column="Adjusted P-value",
        # column="Overlap",
        x="Direction", y="Term Short",
        ax=axes.flatten()[i], size=20, top_term=100,
        title=x, xticklabels_rot=45, yticklabels_rot=45,
        show_ring=True, marker="o", cutoff=0.5)
    axes.flatten()[i].tick_params(axis="y", labelsize=8,
                                  labelfontfamily="serif")
    axes.flatten()[i].tick_params(axis="x", labelsize=10,
                                  labelfontfamily="serif")
    axes.flatten()[i].title.set_fontsize(10)
if len(axes.flatten()) > len(cts_i):
    for a in axes.flatten()[len(cts_i):]:
        a.set_visible(False)
fig.suptitle("Senescent Cell Spaceflight DEGs", fontsize="xx-large",
             fontproperties=dict(family="serif"))
res_pathways_snc_top_vs_no[["Term Short", "Genes"] + list(
    res_pathways_snc_top_vs_no.columns.difference([
        "Term", "Genes", "Term Short"]))]
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
Out[235]:
Term Short Genes Adjusted P-value Combined Score Gene_set Odds Ratio Old Adjusted P-value Old P-value Overlap P-value level_2
annotation_by_overlap Direction
Space Flight | 12 Weeks up 420 Electron Transport Chain WP295 NDUFA8;UQCRB;NDUFA12;NDUFA4;ATP5E;COX4I1;NDUFC1;COX7A2;COX5A;SLC25A4;COX6B1 3.777844e-20 12289.664347 WikiPathways_2019_Mouse 264.212560 0 0 11/103 6.296407e-21 1494
481 Cellular Respiration (GO:0045333) NDUFA8;NDUFA13;UQCRB;NDUFA12;NDUFA4;COX4I1;NDUFC1;COX7A2;COX7C;COX5A;COX6B1 9.227446e-20 16025.343807 GO_Biological_Process_2025 328.777778 0 0 11/85 6.784887e-22 1791
440 Cellular Respiration (GO:0045333) NDUFA8;NDUFA13;UQCRB;NDUFA12;NDUFA4;COX4I1;NDUFC1;COX7A2;COX7C;COX5A;COX6B1 9.838085e-20 16025.343807 GO_Biological_Process_2023 328.777778 0 0 11/85 6.784887e-22 1646
482 Mitochondrial ATP Synthesis Coupled Electron Transport (GO:0042775) NDUFA8;UQCRB;NDUFA12;NDUFA4;COX4I1;NDUFC1;COX7A2;COX7C;COX5A;COX6B1 7.782512e-19 16634.384561 GO_Biological_Process_2025 362.272727 0 0 10/65 1.144487e-20 1792
317 Striatum RNA M22 Module (Darkgreen) H2AZ1;NDUFA8;NDUFA13;UQCRB;NDUFA12;NDUFA4;COX4I1;NDUFC1;COX7A2;COX7C;COX5A;COX6B1;CHCHD2;ATP5E;S... 1.786554e-18 6179.552039 HDSigDB_Mouse_2021 129.869347 0 0 16/613 2.162899e-21 649
441 Mitochondrial ATP Synthesis Coupled Electron Transport (GO:0042775) NDUFA8;UQCRB;NDUFA12;NDUFA4;COX4I1;NDUFC1;COX7A2;COX7C;COX5A;COX6B1 1.834655e-18 14980.922968 GO_Biological_Process_2023 332.000000 0 0 10/70 2.530558e-20 1647
423 mitochondrial ATP synthesis coupled electron transport (GO:0042775) NDUFA8;NDUFA13;UQCRB;NDUFA12;NDUFA4;COX4I1;NDUFC1;COX7C;COX5A;COX6B1 2.149178e-18 14685.170247 GO_Biological_Process_2021 326.540984 0 0 10/71 2.944080e-20 1501
422 aerobic electron transport chain (GO:0019646) NDUFA8;NDUFA13;UQCRB;NDUFA12;NDUFA4;COX4I1;NDUFC1;COX7C;COX5A;COX6B1 2.149178e-18 14980.922968 GO_Biological_Process_2021 332.000000 0 0 10/70 2.530558e-20 1500
413 Oxidative Phosphorylation NDUFA8;UQCRB;NDUFA4;COX4I1;NDUFC1;COX7A2;COX7C;COX5A;SLC25A4;COX6B1;ATP6V1F 9.409673e-17 4989.032439 MSigDB_Hallmark_2020 127.984127 0 0 11/200 1.176209e-17 1475
483 Aerobic Electron Transport Chain (GO:0019646) NDUFA8;UQCRB;NDUFA4;COX4I1;NDUFC1;COX7A2;COX7C;COX5A;COX6B1 1.447739e-16 11940.792637 GO_Biological_Process_2025 296.404959 0 0 9/64 3.193542e-18 1793
Space Flight | 29 Weeks up 1036 Mitochondrial ATP Synthesis Coupled Electron Transport (GO:0042775) NDUFA8;UQCRB;NDUFA12;NDUFA4;COX4I1;NDUFA1;UQCR11;NDUFC1;COX7A2;COX6C;COX7C 1.980073e-21 23409.272197 GO_Biological_Process_2025 451.000000 0 0 11/65 2.869671e-23 1618
1010 Mitochondrial ATP Synthesis Coupled Electron Transport (GO:0042775) NDUFA8;UQCRB;NDUFA12;NDUFA4;COX4I1;NDUFA1;UQCR11;NDUFC1;COX7A2;COX6C;COX7C 4.500231e-21 21056.609585 GO_Biological_Process_2023 412.676083 0 0 11/70 6.923432e-23 1553
994 Electron Transport Chain WP295 NDUFA8;UQCRB;NDUFA12;NDUFA4;ATP5E;COX4I1;NDUFA1;UQCR11;NDUFC1;COX7A2;COX6C 1.888922e-20 12289.664347 WikiPathways_2019_Mouse 264.212560 0 0 11/103 6.296407e-21 1399
1011 Cellular Respiration (GO:0045333) NDUFA8;UQCRB;NDUFA12;NDUFA4;COX4I1;NDUFA1;UQCR11;NDUFC1;COX7A2;COX6C;COX7C 2.205088e-20 16025.343807 GO_Biological_Process_2023 328.777778 0 0 11/85 6.784887e-22 1554
1037 Cellular Respiration (GO:0045333) NDUFA8;UQCRB;NDUFA12;NDUFA4;COX4I1;NDUFA1;UQCR11;NDUFC1;COX7A2;COX6C;COX7C 2.340786e-20 16025.343807 GO_Biological_Process_2025 328.777778 0 0 11/85 6.784887e-22 1619
1038 Aerobic Electron Transport Chain (GO:0019646) NDUFA8;UQCRB;NDUFA4;COX4I1;NDUFA1;UQCR11;NDUFC1;COX7A2;COX6C;COX7C 2.228347e-19 17004.756449 GO_Biological_Process_2025 369.000000 0 0 10/64 9.688466e-21 1620
1012 Aerobic Electron Transport Chain (GO:0019646) NDUFA8;UQCRB;NDUFA4;COX4I1;NDUFA1;UQCR11;NDUFC1;COX7A2;COX6C;COX7C 4.022118e-19 15605.480700 GO_Biological_Process_2023 343.482759 0 0 10/68 1.856362e-20 1555
998 mitochondrial ATP synthesis coupled electron transport (GO:0042775) NDUFA8;UQCRB;NDUFA12;NDUFA4;COX4I1;NDUFA1;UQCR11;NDUFC1;COX6C;COX7C 2.222780e-18 14685.170247 GO_Biological_Process_2021 326.540984 0 0 10/71 2.944080e-20 1403
997 aerobic electron transport chain (GO:0019646) NDUFA8;UQCRB;NDUFA12;NDUFA4;COX4I1;NDUFA1;UQCR11;NDUFC1;COX6C;COX7C 2.222780e-18 14980.922968 GO_Biological_Process_2021 332.000000 0 0 10/70 2.530558e-20 1402
894 Striatum RNA M22 Module (Darkgreen) NDUFA8;UQCRB;NDUFA12;NDUFA4;COX4I1;POMP;UQCR11;NDUFC1;COX7A2;COX6C;COX7C;UBL5;CHCHD2;ATP5E;TOMM7 1.594720e-16 4175.088817 HDSigDB_Mouse_2021 97.234114 0 0 15/613 2.249253e-19 683
No description has been provided for this image
In [231]:
# df_degs = out_edgr_old_sf_v_gc.copy()
# df_degs = out_edgr_batches_snc_top.copy()
# df_degs = res_snc_grps.copy()

# factor_name = col_celltype
# factor_name = col_condition
factor_name = col_batch

df_degs = res_rank_genes_top.loc[:, "Overall", :]
df_degs = df_degs.assign(log_fc=df_degs.logfoldchanges.abs())
df_degs = df_degs.assign(abs_log_fc=df_degs.logfoldchanges_abs)

names = gp.get_library_name()
# [i for i in names if "brain" in i.lower() or "mouse" in i.lower()]
pathways_snc_vs_no, res_pathways_snc_vs_no = {}, {}
thresh_p_path = 0.05
# perts_geo = ["Aging", "Drug", "Disease"]
perts_geo = ["Aging", "Disease"]
other_sets = ["GTEx_Aging_Signatures_2021", f"HDSigDB_{species}_2021",
              # "DGIdb_Drug_Targets_2024",
              "MSigDB_Hallmark_2020",
              "MSigDB_Oncogenic_Signatures", "OMIM_Disease",
              # "Reactome_Pathways_2024", "Reactome_2022",
              f"WikiPathways_2024_{species}", f"WikiPathways_2019_{species}"]
other_sets += [i for i in names if "GO_Biological_Process" in i]
# if species.lower() == "mouse":
#     other_sets += ["PerturbAtlas_MouseGenePerturbationSigs"]
for x in df_degs.reset_index()[factor_name].unique():
    pathways_snc_vs_no[x], res_pathways_snc_vs_no[x] = {}, {}
    for i in ["up", "down"]:
        degs_tmp = df_degs.loc[x]
        if i == "up":
            degs_tmp = list(degs_tmp[degs_tmp.log_fc > 0].index.values)
        else:
            degs_tmp = list(degs_tmp[degs_tmp.log_fc < 0].index.values)
        if len(degs_tmp) > 0:
            g_s = [f"{u}_Perturbations_from_GEO_{i}" for u in perts_geo] + [
                f"Disease_Signatures_from_GEO_{i}_2014"] + other_sets
            g_s = [g for g in g_s if g in names]
            pathways_snc_vs_no[x][i] = gp.enrichr(
                gene_list=degs_tmp, gene_sets=g_s,
                organism=species, cutoff=0.5)
            res_pathways_snc_vs_no[x][i] = pathways_snc_vs_no[x][i].results[
                pathways_snc_vs_no[x][i].results[
                    "Adjusted P-value"] < thresh_p_path]
    res_pathways_snc_vs_no[x] = pd.concat(res_pathways_snc_vs_no[x],
                                          names=["Direction"])
res_pathways_snc_vs_no = pd.concat(res_pathways_snc_vs_no,
                                   names=[col_celltype])
res_pathways_snc_vs_no.loc[
    :, "Term Short"] = res_pathways_snc_vs_no.Term.apply(
        lambda x: re.sub("Expression Of ", "", re.sub(".*.xls", "", re.sub(
            ".*.XLSX", "",
            re.sub(".*Supplementary Table [0-9]+[-]?", "", re.sub(
                ".*.xlsx.", "", re.sub(".*Supplementary Data ..", "", re.sub(
                    "PMID([0-9])+", "", re.sub(
                        "([0-9]+) years v ([0-9]+) years", "\\1 v \\2 yrs.",
                        re.sub("aging:([0-9]+)", "aging", re.sub(
                            "([0-9]+) months v ([0-9]+) mo(nths)?",
                            "\\1 v \\2 mo.", re.sub("SRP[0-9]+ ", "", re.sub(
                                "GSE[0-9]+ ", "", x)))))))))))))
cts_i = res_pathways_snc_vs_no.reset_index()[col_celltype].unique()
res_pathways_snc_top_vs_no = res_pathways_snc_vs_no.reset_index().groupby([
    col_celltype, "Direction"]).apply(lambda x: x.sort_values(
        "Adjusted P-value", ascending=True).head(10), include_groups=False)
fig, axes = plt.subplots(*scflow.pl.square_grid(cts_i), figsize=(
    20, 25), gridspec_kw=dict(wspace=1.5, top=0.95), squeeze=False)
for i, x in enumerate(cts_i):
    gp.dotplot(
        res_pathways_snc_top_vs_no.loc[x].reset_index(),
        column="Adjusted P-value",
        # column="Overlap",
        x="Direction", y="Term Short",
        ax=axes.flatten()[i], size=20, top_term=100,
        title=x, xticklabels_rot=45, yticklabels_rot=45,
        show_ring=True, marker="o", cutoff=0.5)
    axes.flatten()[i].tick_params(axis="y", labelsize=8,
                                  labelfontfamily="serif")
    axes.flatten()[i].tick_params(axis="x", labelsize=10,
                                  labelfontfamily="serif")
    axes.flatten()[i].title.set_fontsize(10)
if len(axes.flatten()) > len(cts_i):
    for a in axes.flatten()[len(cts_i):]:
        a.set_visible(False)
fig.suptitle("Senescent Cell Spaceflight DEGs",
             fontsize="xx-large",
             fontproperties=dict(family="serif"))
res_pathways_snc_top_vs_no[["Term Short", "Genes"] + list(
    res_pathways_snc_top_vs_no.columns.difference([
        "Term", "Genes", "Term Short"]))]
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
Out[231]:
Term Short Genes Adjusted P-value Combined Score Gene_set Odds Ratio Old Adjusted P-value Old P-value Overlap P-value level_2
annotation_by_overlap Direction
Ground Control | 12 Weeks up 6 Genes Changed In iSPNs Of R6/2 Vs WT GRID1;SGIP1;NTM;ATP2B2;ANK2;GRIN2B;DLG2;APC;MMP16;CDH10;B3GALT1;KCNMA1;GRIA3;DYNC1I1;DGKI 9.429651e-14 2368.732160 HDSigDB_Mouse_2021 63.972067 0 0 15/910 8.300749e-17 261
7 Genes Changed In dSPNs Of R6/2 Vs WT GRID1;SGIP1;NTM;ATP2B2;ANK2;GRIN2B;APC;MMP16;CDH10;B3GALT1;KCNMA1;GRIA3;DYNC1I1;DGKI 1.615311e-11 1343.117546 HDSigDB_Mouse_2021 43.061019 0 0 14/1041 2.843857e-14 262
8 Genes Changed In Foxp2/Olfm3-expressing Neurons Of R6/2 Vs WT GRID1;SGIP1;NTM;ATP2B2;ANK2;GRIN2B;TANC2;APC;CDH10;B3GALT1;HIVEP3;GRIA3;DYNC1I1 2.581291e-11 1303.947210 HDSigDB_Mouse_2021 43.010710 0 0 13/840 6.816789e-14 263
9 Up-regulated Genes In Cerebellum Of 6 Mon HD Q140 Mice Vs Q20 GSE78270 GRID1;SGIP1;ATP2B2;ANK2;NOL4;GRIN2B;TANC2;DLG2;APC;B3GALT1;KCNMA1;HIVEP3;AMPH;GRIA3;DYNC1I1 2.798419e-11 1145.601891 HDSigDB_Mouse_2021 38.252581 0 0 15/1468 9.853589e-14 264
11 Top Neuron-Expressed Genes In Humans And Mice DYNC1I2;SGIP1;NTM;ATP2B2;ANK2;GRIN2B;TANC2;DLG2;APC;KCNMA1;AMPH;GRIA3;DYNC1I1 2.254786e-10 930.498937 HDSigDB_Mouse_2021 33.890173 0 0 13/1051 1.190908e-12 266
10 Genes Changed In iSPNs Of zQ175DN Vs WT DLG2;MMP16;SGIP1;NTM;CDH10;B3GALT1;ANK2;HIVEP3;GRIN2B;GRIA3;DYNC1I1 2.254786e-10 1185.862385 HDSigDB_Mouse_2021 43.016908 0 0 11/563 1.065736e-12 265
12 Genes Changed In Chat-expressing Interneurons Of R6/2 Vs WT GRID1;NOL4;GRIN2B;TANC2;DLG2;APC;MMP16;B3GALT1;HIVEP3;AMPH;GRIA3;DYNC1I1;DGKI 5.485884e-10 819.807501 HDSigDB_Mouse_2021 31.037994 0 0 13/1141 3.380386e-12 267
13 Genes Up-Regulated In Control iPSCs After 60 D Of Differentiation GSE109534 DYNC1I2;GRID1;SGIP1;NTM;ATP2B2;ANK2;NOL4;GRIN2B;TANC2;DLG2;APC;CDH10;KCNMA1;HIVEP3;AMPH;GRIA3;DY... 6.402671e-10 1083.738559 HDSigDB_Mouse_2021 41.482875 0 0 18/3580 4.508923e-12 268
14 Genes Up-Regulated In Sst/Npy-expressing Interneurons Of R6/2 Vs WT DLG2;APC;MMP16;CDH10;B3GALT1;KCNMA1;ANK2;NOL4;TANC2 1.212627e-09 1299.964101 HDSigDB_Mouse_2021 51.243196 0 0 9/323 9.607078e-12 269
15 Top Neuron-Enriched Genes In Humans And Mice DLG2;MMP16;SGIP1;CDH10;B3GALT1;KCNMA1;ATP2B2;AMPH;NOL4;GRIN2B;GRIA3;DYNC1I1 2.780780e-09 691.246334 HDSigDB_Mouse_2021 28.291252 0 0 12/1018 2.447870e-11 270
Ground Control | 29 Weeks up 507 Negative Regulation Of Peptidase Activity (GO:0010466) SERPINE2;TIMP2;NRG1;CTSB 9.062129e-05 1324.283459 GO_Biological_Process_2023 88.946429 0 0 4/60 3.419671e-07 2017
508 Negative Regulation Of Proteolysis (GO:0045861) SERPINE2;TIMP2;CTSB 1.178829e-03 1077.036200 GO_Biological_Process_2023 92.609907 0 0 3/41 8.896824e-06 2018
510 Negative Regulation Of Endopeptidase Activity (GO:0010951) SERPINE2;TIMP2;NRG1 1.897170e-03 568.434094 GO_Biological_Process_2023 55.789916 0 0 3/66 3.758775e-05 2020
509 Negative Regulation Of Platelet Aggregation (GO:0090331) SERPINE2;CD9 1.897170e-03 3897.964407 GO_Biological_Process_2023 369.888889 0 0 2/8 2.650430e-05 2019
512 Regulation Of Endopeptidase Activity (GO:0052548) SERPINE2;TIMP2;NRG1 1.897170e-03 535.407712 GO_Biological_Process_2023 53.245989 0 0 3/69 4.295480e-05 2022
511 Negative Regulation Of Homotypic Cell-Cell Adhesion (GO:0034111) SERPINE2;CD9 1.897170e-03 2791.902845 GO_Biological_Process_2023 277.388889 0 0 2/10 4.254530e-05 2021
513 Negative Regulation Of Platelet Activation (GO:0010544) SERPINE2;CD9 3.746939e-03 1573.576348 GO_Biological_Process_2023 170.658120 0 0 2/15 9.897575e-05 2023
514 Heart Trabecula Morphogenesis (GO:0061384) S1PR1;NRG1 4.768772e-03 1226.393330 GO_Biological_Process_2023 138.638889 0 0 2/18 1.439629e-04 2024
475 Status Epilepticus C0038220 rat sample 391 SERPINE2;VGF;TIMP2;CD9;CTSB 5.809842e-03 218.064714 Disease_Perturbations_from_GEO_up 19.787513 0 0 5/336 1.636575e-05 146
517 Negative Regulation of Platelet Aggregation (GO:0090331) SERPINE2;CD9 5.846481e-03 3261.459893 GO_Biological_Process_2025 317.031746 0 0 2/9 3.405660e-05 2282
Space Flight | 12 Weeks up 530 Genes Changed In Cerebellum Of 12 Week Old Atxn1[154Q/2Q] Vs WT GSE122099 KCNJ6;AIFM3;VGF;TIMP2;ADCY2;SLC6A11;HIVEP3;MIF;HMGB1;KALRN;KCNH1 1.440888e-03 129.867923 HDSigDB_Mouse_2021 9.867696 0 0 11/2213 1.924361e-06 558
531 Genes Up-Regulated In Pvalb/Th-expressing Interneurons Of HD Patients Vs Control KCNJ6;FAM135B;TIMP2;FMN1;ADCY2;HMGB1;PBX1 1.440888e-03 202.340571 HDSigDB_Mouse_2021 15.664041 0 0 7/671 2.454664e-06 559
533 Yellow Module Eigengene Expression Profile Across Striatal Astrocytes Of R6/2 And Q175 Mice NEUROD2;KCNJ6;FAM135B;VGF;9130024F11RIK;KALRN;KCNH1 1.866948e-03 161.172389 HDSigDB_Mouse_2021 13.469952 0 0 7/775 6.360982e-06 561
532 Mouse Glia-Enriched Genes NEUROD2;KCNJ6;AIFM3;MICAL2;9130024F11RIK;FMN1;ADCY2;SLC6A11;HIVEP3 1.866948e-03 123.862865 HDSigDB_Mouse_2021 10.219815 0 0 9/1490 5.450114e-06 560
534 Genes Up-Regulated In Brain Vs Spinal Cord Derived OPCs From P7 Mice NEUROD2;KCNJ6;AIFM3;VGF;MICAL2;9130024F11RIK;KCNH1 2.378468e-03 143.774537 HDSigDB_Mouse_2021 12.502098 0 0 7/832 1.012976e-05 562
535 Genes Down-Regulated In The Cortex Of zQ175 Neo- Mice Vs WT GSE123657 AIFM3;MICAL2;FMN1;ADCY2;KALRN;KCNH1 5.531236e-03 133.588136 HDSigDB_Mouse_2021 12.847176 0 0 6/651 3.048582e-05 563
537 Top Neuron-Specific Genes In Humans And Mice NEUROD2;KCNJ6;FAM135B;VGF;MICAL2;KALRN;KCNH1 5.531236e-03 102.802236 HDSigDB_Mouse_2021 10.092429 0 0 7/1019 3.769156e-05 565
536 Top Neuron-Enriched Genes In Humans And Mice KCNJ6;FAM135B;VGF;MICAL2;ADCY2;KALRN;KCNH1 5.531236e-03 102.973029 HDSigDB_Mouse_2021 10.102945 0 0 7/1018 3.745472e-05 564
524 Malignant mesothelioma of pleura C0812413 human sample 118 MICAL2;MIF;HMGB1;PBX1;CTSB 1.216834e-02 170.230032 Disease_Perturbations_from_GEO_up 16.656463 0 0 5/397 3.643214e-05 129
538 Genes Changed In Pvalb/Th-expressing Interneurons Of R6/2 Vs WT FAM135B;MICAL2;HIVEP3;KALRN;PBX1;KCNH1 1.297377e-02 92.699828 HDSigDB_Mouse_2021 10.142857 0 0 6/816 1.073496e-04 566
Space Flight | 29 Weeks up 572 Genes Up-Regulated In Endothelial Cells Of zQ175DN Vs WT DST;PCDH9;NAV3;MAGI2;MYCBP2;KCNQ3;UBR3;CCSER1;MDGA2;GPHN;PTK2 1.535462e-10 1549.174518 HDSigDB_Mouse_2021 52.330409 0 0 11/467 1.390817e-13 348
573 Genes Changed In Foxp2/Olfm3-expressing Neurons Of R6/2 Vs WT PCDH9;NBEA;NAV3;DENND1A;MAGI2;KCNQ3;CCSER1;PRICKLE1;MDGA2;KALRN;GPHN;STXBP5L 1.421789e-09 925.849932 HDSigDB_Mouse_2021 34.695652 0 0 12/840 2.575705e-12 349
574 Genes Changed In Pvalb/Th-expressing Interneurons Of R6/2 Vs WT PCLO;PCDH9;NAV3;DENND1A;MAGI2;MYCBP2;KCNQ3;CCSER1;MDGA2;KALRN;STXBP5L 1.991572e-08 685.957702 HDSigDB_Mouse_2021 29.113182 0 0 11/816 5.851390e-11 350
575 Genes Changed In Ciliated Ependymal Cells Of HD Patients Vs Control DST;PCDH9;DENND1A;MAGI2;MYCBP2;UBR3;KALRN;GPHN;PTK2;STXBP5L;PCLO;NBEA;NAV3;AKT3;CCSER1;MDGA2 1.991572e-08 567.464042 HDSigDB_Mouse_2021 24.300283 0 0 16/2840 7.215839e-11 351
576 Genes Changed In Foxp2/Olfm3-expressing Neurons Of zQ175DN Vs WT PCLO;PCDH9;NBEA;DENND1A;MAGI2;CCSER1;MDGA2;GPHN;PTK2;STXBP5L 2.880483e-08 707.166832 HDSigDB_Mouse_2021 31.070626 0 0 10/633 1.304566e-10 352
577 Genes Changed In iSPNs Of R6/2 Vs WT PCDH9;NBEA;NAV3;DENND1A;MAGI2;KCNQ3;CCSER1;MDGA2;KALRN;GPHN;STXBP5L 3.455452e-08 580.972458 HDSigDB_Mouse_2021 25.941293 0 0 11/910 1.877963e-10 353
578 Genes Changed In Endothelial Cells Of zQ175DN Vs WT DST;PCDH9;NAV3;MAGI2;MYCBP2;KCNQ3;UBR3;CCSER1;MDGA2;GPHN;PTK2 4.899421e-08 540.168621 HDSigDB_Mouse_2021 24.673854 0 0 11/954 3.106517e-10 354
579 Genes Up-Regulated In Sst/Npy-expressing Interneurons Of R6/2 Vs WT PCLO;DST;PCDH9;NAV3;DENND1A;MAGI2;MYCBP2;MDGA2 6.232223e-08 895.567048 HDSigDB_Mouse_2021 41.619048 0 0 8/323 4.516103e-10 355
580 Genes Changed In dSPNs Of R6/2 Vs WT PCLO;PCDH9;NBEA;NAV3;DENND1A;MAGI2;KCNQ3;CCSER1;MDGA2;KALRN;STXBP5L 9.632781e-08 471.429338 HDSigDB_Mouse_2021 22.486516 0 0 11/1041 7.852810e-10 356
581 Genes Up-Regulated In Control iPSCs After 60 D Of Differentiation GSE109534 PCDH9;MAGI2;MYCBP2;UBR3;KALRN;GPHN;STXBP5L;PCLO;NBEA;NAV3;KCNQ1OT1;AKT3;KCNQ3;MALAT1;CCSER1;MDGA2 2.773367e-07 364.839499 HDSigDB_Mouse_2021 18.424242 0 0 16/3580 2.512107e-09 357
No description has been provided for this image
In [232]:
# df_degs = out_edgr_old_sf_v_gc.copy()
# df_degs = out_edgr_batches_snc_top.copy()
# df_degs = res_snc_grps.copy()

factor_name = col_celltype
# factor_name = col_condition

iii = 2
df_degs = res_rank_genes_top.loc[self.rna.obs[col_batch].unique()[iii]]
df_degs = df_degs.assign(log_fc=df_degs.logfoldchanges.abs())
df_degs = df_degs.assign(abs_log_fc=df_degs.logfoldchanges_abs)
print(self.rna.obs[col_batch].unique()[iii])

names = gp.get_library_name()
# [i for i in names if "brain" in i.lower() or "mouse" in i.lower()]
pathways_snc_vs_no, res_pathways_snc_vs_no = {}, {}
thresh_p_path = 0.05
# perts_geo = ["Aging", "Drug", "Disease"]
perts_geo = ["Aging", "Disease"]
other_sets = ["GTEx_Aging_Signatures_2021", f"HDSigDB_{species}_2021",
              # "DGIdb_Drug_Targets_2024",
              "MSigDB_Hallmark_2020",
              "MSigDB_Oncogenic_Signatures", "OMIM_Disease",
              # "Reactome_Pathways_2024", "Reactome_2022",
              f"WikiPathways_2024_{species}", f"WikiPathways_2019_{species}"]
other_sets += [i for i in names if "GO_Biological_Process" in i]
# if species.lower() == "mouse":
#     other_sets += ["PerturbAtlas_MouseGenePerturbationSigs"]
for x in df_degs.reset_index()[factor_name].unique():
    pathways_snc_vs_no[x], res_pathways_snc_vs_no[x] = {}, {}
    for i in ["up", "down"]:
        degs_tmp = df_degs.loc[x]
        if i == "up":
            degs_tmp = list(degs_tmp[degs_tmp.log_fc > 0].index.values)
        else:
            degs_tmp = list(degs_tmp[degs_tmp.log_fc < 0].index.values)
        if len(degs_tmp) > 0:
            g_s = [f"{u}_Perturbations_from_GEO_{i}" for u in perts_geo] + [
                f"Disease_Signatures_from_GEO_{i}_2014"] + other_sets
            g_s = [g for g in g_s if g in names]
            pathways_snc_vs_no[x][i] = gp.enrichr(
                gene_list=degs_tmp, gene_sets=g_s,
                organism=species, cutoff=0.5)
            res_pathways_snc_vs_no[x][i] = pathways_snc_vs_no[x][i].results[
                pathways_snc_vs_no[x][i].results[
                    "Adjusted P-value"] < thresh_p_path]
    res_pathways_snc_vs_no[x] = pd.concat(res_pathways_snc_vs_no[x],
                                          names=["Direction"])
res_pathways_snc_vs_no = pd.concat(res_pathways_snc_vs_no,
                                   names=[col_celltype])
res_pathways_snc_vs_no.loc[
    :, "Term Short"] = res_pathways_snc_vs_no.Term.apply(
        lambda x: re.sub("Expression Of ", "", re.sub(".*.xls", "", re.sub(
            ".*.XLSX", "",
            re.sub(".*Supplementary Table [0-9]+[-]?", "", re.sub(
                ".*.xlsx.", "", re.sub(".*Supplementary Data ..", "", re.sub(
                    "PMID([0-9])+", "", re.sub(
                        "([0-9]+) years v ([0-9]+) years", "\\1 v \\2 yrs.",
                        re.sub("aging:([0-9]+)", "aging", re.sub(
                            "([0-9]+) months v ([0-9]+) mo(nths)?",
                            "\\1 v \\2 mo.", re.sub("SRP[0-9]+ ", "", re.sub(
                                "GSE[0-9]+ ", "", x)))))))))))))
cts_i = res_pathways_snc_vs_no.reset_index()[col_celltype].unique()
res_pathways_snc_top_vs_no = res_pathways_snc_vs_no.reset_index().groupby([
    col_celltype, "Direction"]).apply(lambda x: x.sort_values(
        "Adjusted P-value", ascending=True).head(10), include_groups=False)
fig, axes = plt.subplots(*scflow.pl.square_grid(cts_i), figsize=(
    20, 25), gridspec_kw=dict(wspace=1.5, top=0.95), squeeze=False)
for i, x in enumerate(cts_i):
    gp.dotplot(
        res_pathways_snc_top_vs_no.loc[x].reset_index(),
        column="Adjusted P-value",
        # column="Overlap",
        x="Direction", y="Term Short",
        ax=axes.flatten()[i], size=20, top_term=100,
        title=x, xticklabels_rot=45, yticklabels_rot=45,
        show_ring=True, marker="o", cutoff=0.5)
    axes.flatten()[i].tick_params(axis="y", labelsize=8,
                                  labelfontfamily="serif")
    axes.flatten()[i].tick_params(axis="x", labelsize=10,
                                  labelfontfamily="serif")
    axes.flatten()[i].title.set_fontsize(10)
if len(axes.flatten()) > len(cts_i):
    for a in axes.flatten()[len(cts_i):]:
        a.set_visible(False)
fig.suptitle("Senescent Cell Spaceflight DEGs", fontsize="xx-large",
             fontproperties=dict(family="serif"))
res_pathways_snc_top_vs_no[["Term Short", "Genes"] + list(
    res_pathways_snc_top_vs_no.columns.difference([
        "Term", "Genes", "Term Short"]))]
Space Flight | 29 Weeks
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
Out[232]:
Term Short Genes Adjusted P-value Combined Score Gene_set Odds Ratio Old Adjusted P-value Old P-value Overlap P-value level_2
annotation_by_overlap Direction
Excitatory up 5 Genes Up-Regulated In Oligodendrocytes Of zQ175DN Vs WT TENM2;SYT1;NEGR1;ADGRB3;CELF2;NRXN1;CTNND2;CSMD1;FGF12 9.868939e-16 14425.378650 HDSigDB_Mouse_2021 346.996132 0 0 9/56 8.819427e-19 345
6 Genes Up-Regulated In Microglial Cells Of zQ175DN Vs WT TENM2;SYT1;NEGR1;ADGRB3;NRXN1;CTNND2;CSMD1;FGF12 4.901372e-14 11987.300746 HDSigDB_Mouse_2021 324.211382 0 0 8/49 8.760272e-17 346
7 Genes Up-Regulated In Astrocytes Of zQ175DN Vs WT TENM2;SYT1;NEGR1;ADGRB3;CELF2;KCNQ3;ERC2;CSMD1 1.382226e-13 9441.901030 HDSigDB_Mouse_2021 265.733333 0 0 8/58 3.705701e-16 347
8 Genes Changed In Microglial Cells Of zQ175DN Vs WT TENM2;SYT1;NEGR1;ADGRB3;NRXN1;CTNND2;CSMD1;FGF12 4.495854e-13 7415.603564 HDSigDB_Mouse_2021 217.693989 0 0 8/69 1.607097e-15 348
9 Genes Changed In Oligodendrocytes Of zQ175DN Vs WT TENM2;SYT1;NEGR1;ADGRB3;CELF2;NRXN1;CTNND2;CSMD1;FGF12 6.366682e-13 4424.009348 HDSigDB_Mouse_2021 132.086475 0 0 9/132 2.844809e-15 349
10 Genes Changed In iSPNs Of zQ175DN Vs WT AHI1;CAMK1D;SYT1;NEGR1;ADGRB3;CELF2;NRXN1;B3GALT1;SORBS2;ERC2;DIP2C;GPR158 4.218271e-12 1661.868528 HDSigDB_Mouse_2021 52.892015 0 0 12/563 2.261807e-14 350
11 Genes Changed In dSPNs Of R6/2 Vs WT CAMK1D;SYT1;NEGR1;CELF2;NRXN1;SORBS2;PCLO;ADGRB3;B3GALT1;KCNQ3;ERC2;CSMD1;FGF12;GPR158 4.546108e-12 1343.117546 HDSigDB_Mouse_2021 43.061019 0 0 14/1041 2.843857e-14 351
12 Genes Changed In Astrocytes Of zQ175DN Vs WT TENM2;SYT1;NEGR1;ADGRB3;CELF2;KCNQ3;ERC2;CSMD1 4.715813e-12 4464.460737 HDSigDB_Mouse_2021 144.115942 0 0 8/100 3.518145e-14 352
13 Genes Down-Regulated In Foxp2/Olfm3-expressing Neurons Of R6/2 Vs WT AHI1;CAMK1D;SYT1;NEGR1;ADGRB3;CELF2;B3GALT1;KCNQ3;SORBS2;ERC2;DIP2C;GPR158 4.715813e-12 1561.570553 HDSigDB_Mouse_2021 50.531250 0 0 12/588 3.792879e-14 353
14 Genes Down-Regulated In iSPNs Of zQ175DN Vs WT AHI1;CAMK1D;SYT1;NEGR1;ADGRB3;CELF2;B3GALT1;SORBS2;ERC2;DIP2C;GPR158 5.696360e-12 1763.714254 HDSigDB_Mouse_2021 57.621151 0 0 11/426 5.090581e-14 354
Excitatory-Inhibitory up 411 dementia MAPT 2.861721e-02 423.083052 OMIM_Disease 95.545455 0 0 1/12 1.193737e-02 940
412 parkinson disease MAPT 2.861721e-02 191.420591 OMIM_Disease 50.022556 0 0 1/22 2.178169e-02 941
413 hypertension NR3C2 2.861721e-02 133.278878 OMIM_Disease 37.503759 0 0 1/29 2.861721e-02 942
415 Stress Granule Assembly (GO:0034063) G3BP2;MAPT 3.851057e-02 788.330757 GO_Biological_Process_2025 96.410628 0 0 2/25 2.810990e-04 1266
414 Stress Granule Assembly (GO:0034063) G3BP2;MAPT 4.010875e-02 832.549579 GO_Biological_Process_2023 100.797980 0 0 2/24 2.587661e-04 1111
Inhibitory up 416 Mouse Glia-Enriched Genes PLEKHG3;SPSB1;ASAH2;CCDC15;EYA4;DKKL1;CORO6;PACSIN3;HR;PARVA;BHLHE22 3.229224e-05 262.974230 HDSigDB_Mouse_2021 15.288934 0 0 11/1490 3.388482e-08 206
417 Fatty Acid Oxidation WP2318 CPT2 4.356338e-02 538.335775 WikiPathways_2024_Mouse 116.789474 0 0 1/10 9.957248e-03 1200
418 Mitochondrial Long Chain Fatty Acid Beta Oxidation WP401 CPT2 4.356338e-02 290.178721 WikiPathways_2024_Mouse 70.052632 0 0 1/16 1.588634e-02 1201
419 Signal Transduction Of S1P Receptor WP57 ASAH2 4.356338e-02 191.420591 WikiPathways_2024_Mouse 50.022556 0 0 1/22 2.178169e-02 1202
420 Fatty acid oxidation WP2318 CPT2 4.356338e-02 538.335775 WikiPathways_2019_Mouse 116.789474 0 0 1/10 9.957248e-03 1206
421 Mitochondrial LC-Fatty Acid Beta-Oxidation WP401 CPT2 4.356338e-02 290.178721 WikiPathways_2019_Mouse 70.052632 0 0 1/16 1.588634e-02 1207
422 Signal Transduction of S1P Receptor WP57 ASAH2 4.356338e-02 191.420591 WikiPathways_2019_Mouse 50.022556 0 0 1/22 2.178169e-02 1208
Microglial up 428 Top Oligodendrocyte-Enriched Genes In Humans And Mice TMOD1;FA2H;HIP1;GLRB;PLEKHB1;ENDOD1;CCP110;MRPL48;SLAIN1;PAKAP 1.810149e-05 332.952999 HDSigDB_Mouse_2021 18.492683 0 0 10/1035 1.516038e-08 425
429 Down-regulated Genes In Cortex Of 10 Mon HD Q140 Mice Vs Q20 GSE78272 TMOD1;FA2H;HIP1;DTNA;SEMA6D;CCP110;SLAIN1 3.844163e-05 454.994651 HDSigDB_Mouse_2021 27.478365 0 0 7/391 6.439134e-08 426
430 Differentially Expressed Genes In Cortex Of 10 Mon HD Q140 Mice Vs Q20 GSE78272 TMOD1;FA2H;HIP1;DTNA;SEMA6D;CCP110;SLAIN1;PCYOX1 5.981462e-05 300.934955 HDSigDB_Mouse_2021 19.154762 0 0 8/680 1.502880e-07 427
431 Oligodendrocyte Gene Module From Human Brain FA2H;HIP1;PLEKHB1;ENDOD1;CCP110;MRPL48;KIF3C 4.567290e-04 225.893209 HDSigDB_Mouse_2021 16.870052 0 0 7/625 1.530081e-06 428
432 Genes Up-Regulated In Pons Of 28 Week WT Mice Vs Atxn 1 154Q/2Q Mice Both Treated With Vehicle G... TMOD1;FA2H;GLRB;SEMA6D;PLEKHB1;ENDOD1;CCP110;MRPL48;SLAIN1;KIF3C 1.134028e-03 116.302476 HDSigDB_Mouse_2021 9.488189 0 0 10/1915 4.748863e-06 429
433 Genes Changed In Striatum Of R6/2 Vs WT Mice GSE109416 TMOD1;DTNA;SEMA6D;PLEKHB1;ENDOD1;CCP110;MRPL48;SYNE1;PAKAP;FA2H;SIN3B;PUF60;C130023A14RIK;KIF3C 1.188821e-03 99.871906 HDSigDB_Mouse_2021 8.303217 0 0 14/4397 5.973976e-06 430
434 Genes Changed In Pons Of 28 Week Old WT Mice Vs Atxn 1 154Q/2Q Mice Both Treated With Vehicle GS... TMOD1;FA2H;SIN3B;GLRB;PPME1;SEMA6D;PLEKHB1;ENDOD1;CCP110;MRPL48;SLAIN1;KIF3C 3.626597e-03 76.956862 HDSigDB_Mouse_2021 7.189475 0 0 12/3461 2.245269e-05 431
435 Oligodendrocyte Gene Module From Cerebral Cortex TMOD1;FA2H;HIP1;PLEKHB1;ENDOD1;CCP110;KIF3C 3.626597e-03 110.537796 HDSigDB_Mouse_2021 10.564182 0 0 7/976 2.856151e-05 432
437 Mouse Cortex Mature Oligodendrocyte Markers FA2H;HIP1;PUF60;SEMA6D;PLEKHB1;ENDOD1;CCP110;MRPL48;SLAIN1 3.626597e-03 84.358435 HDSigDB_Mouse_2021 8.109875 0 0 9/1840 3.037351e-05 434
436 Down-regulated Genes In Cerebellum Of 6 Mon HD Q175 Mice Vs Q20 GSE73468 FA2H;GLRB;PLEKHB1;ENDOD1;CCP110;MRPL48;SLAIN1;PAKAP 3.626597e-03 94.424433 HDSigDB_Mouse_2021 9.055961 0 0 8/1378 2.962858e-05 433
Oligodendrocyte up 501 Cancer of prostate GSE1413 CD9;MLLT1;SNX10;S100A10 6.761483e-03 141.692774 Disease_Signatures_from_GEO_up_2014 16.625000 0 0 4/300 1.988671e-04 393
Overall up 503 Genes Up-Regulated In Endothelial Cells Of zQ175DN Vs WT DST;PCDH9;NAV3;MAGI2;MYCBP2;KCNQ3;UBR3;CCSER1;MDGA2;GPHN;PTK2 1.535462e-10 1549.174518 HDSigDB_Mouse_2021 52.330409 0 0 11/467 1.390817e-13 348
504 Genes Changed In Foxp2/Olfm3-expressing Neurons Of R6/2 Vs WT PCDH9;NBEA;NAV3;DENND1A;MAGI2;KCNQ3;CCSER1;PRICKLE1;MDGA2;KALRN;GPHN;STXBP5L 1.421789e-09 925.849932 HDSigDB_Mouse_2021 34.695652 0 0 12/840 2.575705e-12 349
505 Genes Changed In Pvalb/Th-expressing Interneurons Of R6/2 Vs WT PCLO;PCDH9;NAV3;DENND1A;MAGI2;MYCBP2;KCNQ3;CCSER1;MDGA2;KALRN;STXBP5L 1.991572e-08 685.957702 HDSigDB_Mouse_2021 29.113182 0 0 11/816 5.851390e-11 350
506 Genes Changed In Ciliated Ependymal Cells Of HD Patients Vs Control DST;PCDH9;DENND1A;MAGI2;MYCBP2;UBR3;KALRN;GPHN;PTK2;STXBP5L;PCLO;NBEA;NAV3;AKT3;CCSER1;MDGA2 1.991572e-08 567.464042 HDSigDB_Mouse_2021 24.300283 0 0 16/2840 7.215839e-11 351
507 Genes Changed In Foxp2/Olfm3-expressing Neurons Of zQ175DN Vs WT PCLO;PCDH9;NBEA;DENND1A;MAGI2;CCSER1;MDGA2;GPHN;PTK2;STXBP5L 2.880483e-08 707.166832 HDSigDB_Mouse_2021 31.070626 0 0 10/633 1.304566e-10 352
508 Genes Changed In iSPNs Of R6/2 Vs WT PCDH9;NBEA;NAV3;DENND1A;MAGI2;KCNQ3;CCSER1;MDGA2;KALRN;GPHN;STXBP5L 3.455452e-08 580.972458 HDSigDB_Mouse_2021 25.941293 0 0 11/910 1.877963e-10 353
509 Genes Changed In Endothelial Cells Of zQ175DN Vs WT DST;PCDH9;NAV3;MAGI2;MYCBP2;KCNQ3;UBR3;CCSER1;MDGA2;GPHN;PTK2 4.899421e-08 540.168621 HDSigDB_Mouse_2021 24.673854 0 0 11/954 3.106517e-10 354
510 Genes Up-Regulated In Sst/Npy-expressing Interneurons Of R6/2 Vs WT PCLO;DST;PCDH9;NAV3;DENND1A;MAGI2;MYCBP2;MDGA2 6.232223e-08 895.567048 HDSigDB_Mouse_2021 41.619048 0 0 8/323 4.516103e-10 355
511 Genes Changed In dSPNs Of R6/2 Vs WT PCLO;PCDH9;NBEA;NAV3;DENND1A;MAGI2;KCNQ3;CCSER1;MDGA2;KALRN;STXBP5L 9.632781e-08 471.429338 HDSigDB_Mouse_2021 22.486516 0 0 11/1041 7.852810e-10 356
512 Genes Up-Regulated In Control iPSCs After 60 D Of Differentiation GSE109534 PCDH9;MAGI2;MYCBP2;UBR3;KALRN;GPHN;STXBP5L;PCLO;NBEA;NAV3;KCNQ1OT1;AKT3;KCNQ3;MALAT1;CCSER1;MDGA2 2.773367e-07 364.839499 HDSigDB_Mouse_2021 18.424242 0 0 16/3580 2.512107e-09 357
No description has been provided for this image
In [230]:
# df_degs = out_edgr_old_sf_v_gc.copy()
# df_degs = out_edgr_batches_snc_top.copy()
# df_degs = res_snc_grps.copy()

factor_name = col_celltype
# factor_name = col_condition

iii = 1
df_degs = res_rank_genes_top.loc[self.rna.obs[col_batch].unique()[iii]]
df_degs = df_degs.assign(log_fc=df_degs.logfoldchanges.abs())
df_degs = df_degs.assign(abs_log_fc=df_degs.logfoldchanges_abs)
print(self.rna.obs[col_batch].unique()[iii])

names = gp.get_library_name()
# [i for i in names if "brain" in i.lower() or "mouse" in i.lower()]
pathways_snc_vs_no, res_pathways_snc_vs_no = {}, {}
thresh_p_path = 0.05
# perts_geo = ["Aging", "Drug", "Disease"]
perts_geo = ["Aging", "Disease"]
other_sets = ["GTEx_Aging_Signatures_2021", f"HDSigDB_{species}_2021",
              # "DGIdb_Drug_Targets_2024",
              "MSigDB_Hallmark_2020",
              "MSigDB_Oncogenic_Signatures", "OMIM_Disease",
              # "Reactome_Pathways_2024", "Reactome_2022",
              f"WikiPathways_2024_{species}", f"WikiPathways_2019_{species}"]
other_sets += [i for i in names if "GO_Biological_Process" in i]
# if species.lower() == "mouse":
#     other_sets += ["PerturbAtlas_MouseGenePerturbationSigs"]
for x in df_degs.reset_index()[factor_name].unique():
    pathways_snc_vs_no[x], res_pathways_snc_vs_no[x] = {}, {}
    for i in ["up", "down"]:
        degs_tmp = df_degs.loc[x]
        if i == "up":
            degs_tmp = list(degs_tmp[degs_tmp.log_fc > 0].index.values)
        else:
            degs_tmp = list(degs_tmp[degs_tmp.log_fc < 0].index.values)
        if len(degs_tmp) > 0:
            g_s = [f"{u}_Perturbations_from_GEO_{i}" for u in perts_geo] + [
                f"Disease_Signatures_from_GEO_{i}_2014"] + other_sets
            g_s = [g for g in g_s if g in names]
            pathways_snc_vs_no[x][i] = gp.enrichr(
                gene_list=degs_tmp, gene_sets=g_s,
                organism=species, cutoff=0.5)
            res_pathways_snc_vs_no[x][i] = pathways_snc_vs_no[x][i].results[
                pathways_snc_vs_no[x][i].results[
                    "Adjusted P-value"] < thresh_p_path]
    res_pathways_snc_vs_no[x] = pd.concat(res_pathways_snc_vs_no[x],
                                          names=["Direction"])
res_pathways_snc_vs_no = pd.concat(res_pathways_snc_vs_no,
                                   names=[col_celltype])
res_pathways_snc_vs_no.loc[
    :, "Term Short"] = res_pathways_snc_vs_no.Term.apply(
        lambda x: re.sub("Expression Of ", "", re.sub(".*.xls", "", re.sub(
            ".*.XLSX", "",
            re.sub(".*Supplementary Table [0-9]+[-]?", "", re.sub(
                ".*.xlsx.", "", re.sub(".*Supplementary Data ..", "", re.sub(
                    "PMID([0-9])+", "", re.sub(
                        "([0-9]+) years v ([0-9]+) years", "\\1 v \\2 yrs.",
                        re.sub("aging:([0-9]+)", "aging", re.sub(
                            "([0-9]+) months v ([0-9]+) mo(nths)?",
                            "\\1 v \\2 mo.", re.sub("SRP[0-9]+ ", "", re.sub(
                                "GSE[0-9]+ ", "", x)))))))))))))
cts_i = res_pathways_snc_vs_no.reset_index()[col_celltype].unique()
res_pathways_snc_top_vs_no = res_pathways_snc_vs_no.reset_index().groupby([
    col_celltype, "Direction"]).apply(lambda x: x.sort_values(
        "Adjusted P-value", ascending=True).head(10), include_groups=False)
fig, axes = plt.subplots(*scflow.pl.square_grid(cts_i), figsize=(
    20, 25), gridspec_kw=dict(wspace=1.5, top=0.95), squeeze=False)
for i, x in enumerate(cts_i):
    gp.dotplot(
        res_pathways_snc_top_vs_no.loc[x].reset_index(),
        column="Adjusted P-value",
        # column="Overlap",
        x="Direction", y="Term Short",
        ax=axes.flatten()[i], size=20, top_term=100,
        title=x, xticklabels_rot=45, yticklabels_rot=45,
        show_ring=True, marker="o", cutoff=0.5)
    axes.flatten()[i].tick_params(axis="y", labelsize=8,
                                  labelfontfamily="serif")
    axes.flatten()[i].tick_params(axis="x", labelsize=10,
                                  labelfontfamily="serif")
    axes.flatten()[i].title.set_fontsize(10)
if len(axes.flatten()) > len(cts_i):
    for a in axes.flatten()[len(cts_i):]:
        a.set_visible(False)
fig.suptitle("Senescent Cell Spaceflight DEGs", fontsize="xx-large",
             fontproperties=dict(family="serif"))
res_pathways_snc_top_vs_no[["Term Short", "Genes"] + list(
    res_pathways_snc_top_vs_no.columns.difference([
        "Term", "Genes", "Term Short"]))]
Ground Control | 29 Weeks
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
/home/easlinger/miniconda3/envs/rsc/lib/python3.13/site-packages/gseapy/plot.py:754: DeprecationWarning: DataFrameGroupBy.apply operated on the grouping columns. This behavior is deprecated, and in a future version of pandas the grouping columns will be excluded from the operation. Either pass `include_groups=False` to exclude the groupings or explicitly select the grouping columns after groupby to silence this warning.
  .apply(lambda _x: _x.sort_values(by=self.colname).tail(self.n_terms))
Out[230]:
Term Short Genes Adjusted P-value Combined Score Gene_set Odds Ratio Old Adjusted P-value Old P-value Overlap P-value level_2
annotation_by_overlap Direction
Astrocyte up 1 Top Astrocyte-Enriched Genes In Humans And Mice LGI1;WDR17;DGKB;SGIP1;CTNND2;MMD2;FMN2;BCAN;TOX;SOX6;NCKAP5;BRINP3;RGS7 1.291089e-09 925.100860 HDSigDB_Mouse_2021 33.752948 0 0 13/1055 1.249844e-12 258
2 Genes Changed In Pvalb/Th-expressing Interneurons Of HD Patients Vs Control LGI1;WDR17;DGKB;SGIP1;CTNND2;MMD2;FMN2;DAB1;SOX6;NCKAP5;BRINP3;CBR4;GAS8;RGS7 7.114723e-07 367.758962 HDSigDB_Mouse_2021 18.024745 0 0 14/2304 1.377487e-09 259
3 Genes Changed In Astrocytes Of HD Patients Vs Control LGI1;WDR17;DGKB;SGIP1;MMD2;FMN2;BCAN;TOX;SOX6;NCKAP5;BRINP3;CBR4;RGS7 1.005231e-05 241.836387 HDSigDB_Mouse_2021 13.939245 0 0 13/2362 2.919355e-08 260
4 Genes Down-Regulated In Astrocytes Of HD Patients Vs Control LGI1;WDR17;BCAN;SGIP1;MMD2;TOX;SOX6;NCKAP5;BRINP3;CBR4;RGS7 1.752029e-05 226.016634 HDSigDB_Mouse_2021 13.879819 0 0 11/1628 8.472696e-08 261
6 Genes Up-Regulated In Ciliated Ependymal Cells Of zQ175DN Vs WT WDR17;DAB1;DGKB;CTNND2;SOX6;BRINP3 1.752029e-05 568.275792 HDSigDB_Mouse_2021 35.399283 0 0 6/245 1.066926e-07 263
5 Genes Up-Regulated In OPCs Of HD Patients Vs Control DGKB;SGIP1;CTNND2;MMD2;FMN2;TOX;NCKAP5 1.752029e-05 418.683167 HDSigDB_Mouse_2021 25.895105 0 0 7/414 9.509123e-08 262
7 Genes Changed In Ciliated Ependymal Cells Of zQ175DN Vs WT LGI1;WDR17;DAB1;DGKB;CTNND2;SOX6;BRINP3 1.752029e-05 396.091544 HDSigDB_Mouse_2021 24.895254 0 0 7/430 1.230932e-07 264
8 Genes Up-Regulated In Pvalb/Th-expressing Interneurons Of HD Patients Vs Control LGI1;DAB1;SGIP1;CTNND2;MMD2;FMN2;SOX6;BRINP3 1.752029e-05 307.147712 HDSigDB_Mouse_2021 19.423831 0 0 8/671 1.356848e-07 265
9 Top OPC-enriched Genes In Humans And Mice BCAN;DAB1;CTNND2;MMD2;FMN2;TOX;SOX6;NCKAP5;BRINP3 3.102987e-05 227.189098 HDSigDB_Mouse_2021 15.022199 0 0 9/1041 2.703473e-07 266
10 Genes Changed In Astrocytes Of R6/2 Vs WT WDR17;BCAN;SGIP1;MMD2;NCKAP5 3.466799e-05 670.424264 HDSigDB_Mouse_2021 44.972789 0 0 5/152 3.356049e-07 267
Excitatory up 85 Genes Down-Regulated In Sst/Npy-expressing Interneurons Of HD Patients Vs Control PDIA3;RBM39;UVRAG;PTPN1;DYNC1H1;KCNJ6;UBE2E2;NRG1;DDX50;SCAF8;SIPA1L1;OLFM3;CPD;TET3;PHF24;ATXN7... 1.119974e-05 338.279839 HDSigDB_Mouse_2021 18.463768 0 0 17/4709 1.104510e-08 355
86 Genes Down-Regulated In Foxp2/Olfm3-expressing Neurons Of HD Patients Vs Control RBM39;SCAF8;SIPA1L1;OLFM3;DESI2;UBE2E2;NRG1;ATXN7L1;PAXBP1;FAM118B 3.348232e-03 108.678502 HDSigDB_Mouse_2021 9.111336 0 0 10/1986 6.604008e-06 356
87 Genes Down-Regulated In Endothelial Cells Of R6/2 Vs WT DESI2;CPD;NRG1;ATXN7L1 9.082970e-03 297.765344 HDSigDB_Mouse_2021 28.292857 0 0 4/179 2.687269e-05 357
88 Genes Changed In Endothelial Cells Of R6/2 Vs WT DESI2;CPD;NRG1;ATXN7L1;DDX50 1.711809e-02 139.877012 HDSigDB_Mouse_2021 14.565996 0 0 5/452 6.752698e-05 358
89 Striatum RNA M14 Module (Cyan) PDIA3;PTPN1;SCAF8;TET3;DDX50;FAM118B 1.938115e-02 95.976560 HDSigDB_Mouse_2021 10.369483 0 0 6/799 9.556780e-05 359
90 Genes Down-Regulated In iSPNs Of HD Patients Vs Control PDIA3;RBM39;PTPN1;DYNC1H1;SIPA1L1;OLFM3;DESI2;UBE2E2;NRG1;PAXBP1;DDX50 2.703019e-02 50.670152 HDSigDB_Mouse_2021 5.797036 0 0 11/3490 1.599420e-04 360
91 Genes Changed In iSPNs Of zQ175DN Vs WT SIPA1L1;OLFM3;PHF24;NRG1;ATXN7L1 2.745761e-02 99.440407 HDSigDB_Mouse_2021 11.602151 0 0 5/563 1.895496e-04 361
92 Genes Changed In Foxp2/Olfm3-expressing Neurons Of HD Patients Vs Control RBM39;KCNJ6;SCAF8;SIPA1L1;OLFM3;DESI2;UBE2E2;NRG1;ATXN7L1;PAXBP1;FAM118B 2.909703e-02 43.530959 HDSigDB_Mouse_2021 5.351129 0 0 11/3726 2.931251e-04 362
93 Genes Down-Regulated In 4-Deoxypyridoxine Treated STHdhQ111 Vs Control GSE129143 UVRAG;PTPN1;DYNC1H1;SCAF8;CPD;TET3 2.909703e-02 67.468227 HDSigDB_Mouse_2021 8.317963 0 0 6/985 3.001741e-04 363
94 Genes Changed In dSPNs Of zQ175DN Vs WT SIPA1L1;OLFM3;PHF24;NRG1;ATXN7L1 2.909703e-02 84.819353 HDSigDB_Mouse_2021 10.460832 0 0 5/622 3.010363e-04 364
Excitatory-Inhibitory up 113 Selective Autophagy (GO:0061912) PEX5;ATG14;ATG4D 8.355795e-03 676.244715 GO_Biological_Process_2023 63.930481 0 0 3/58 2.547498e-05 1474
115 Autophagosome Organization (GO:1905037) TRAF6;ATG14;ATG4D 8.393940e-03 535.407712 GO_Biological_Process_2025 53.245989 0 0 3/69 4.295480e-05 1802
116 Autophagosome Assembly (GO:0000045) TRAF6;ATG14;ATG4D 8.393940e-03 505.553005 GO_Biological_Process_2025 50.923274 0 0 3/72 4.880198e-05 1803
110 Genes Down-Regulated In Expression In The Heart Of Mice Inducibly Expressing Celf1 For 12 H GSE5... APH1A;BAG6;ATP6V1G1;ARV1;TRAF6;PEX5;NCAPD2;B4GALNT1;ANKRD52;GIT1;HCFC1;ATG4D 1.085353e-02 85.953510 HDSigDB_Mouse_2021 7.645560 0 0 12/3289 1.310813e-05 247
112 zellweger syndrome PEX5 1.193737e-02 423.083052 OMIM_Disease 95.545455 0 0 1/12 1.193737e-02 1093
111 Expression In The Heart Of Mice Inducibly Expressing Celf1 For 12 H GSE56185 APH1A;BAG6;ATP6V1G1;ARV1;TRAF6;PEX5;NCAPD2;B4GALNT1;ANKRD52;GIT1;HCFC1;ATG4D 1.309463e-02 71.587984 HDSigDB_Mouse_2021 6.909091 0 0 12/3576 3.162955e-05 248
114 Mitophagy (GO:0000423) ATG14;ATG4D 1.853978e-02 1440.040317 GO_Biological_Process_2023 158.460317 0 0 2/16 1.130474e-04 1475
117 Regulation of Cell Cycle Process (GO:0010564) DCUN1D3;ZW10;GIT1 4.547639e-02 191.742222 GO_Biological_Process_2025 24.480049 0 0 3/146 3.965964e-04 1804
118 Macroautophagy (GO:0016236) PEX5;ATG14;ATG4D 4.621640e-02 165.624538 GO_Biological_Process_2025 21.998890 0 0 3/162 5.374000e-04 1805
Inhibitory up 121 skeletal system development (GO:0001501) TGFB2;NPR3;CREB3L2;HAPLN2 4.937853e-03 354.505843 GO_Biological_Process_2021 32.185065 0 0 4/158 1.645951e-05 1303
120 hypertension NPR3 2.861721e-02 133.278878 OMIM_Disease 37.503759 0 0 1/29 2.861721e-02 1275
119 Differentially Expressed Genes In Hypothalamus/Thalamus Of HD Q175 Mice HHATL;ANO1;KCNJ10;NPR3;HAPLN2 3.241082e-02 169.588664 HDSigDB_Mouse_2021 16.613232 0 0 5/398 3.687238e-05 341
Microglial up 128 Top Oligodendrocyte-Specific Genes In Humans And Mice DOCK5;NRBP2;GPRC5B;GPR37;EFNB3;SCCPDH;WSCD1;DCTN2;PCDH9;SHISA4;ZFP365;PLS1 3.986842e-08 654.084342 HDSigDB_Mouse_2021 27.234420 0 0 12/1055 3.712143e-11 319
129 Top Oligodendrocyte-Enriched Genes In Humans And Mice DOCK5;NRBP2;GPRC5B;GPR37;EFNB3;SCCPDH;WSCD1;PCDH9;SHISA4;ZFP365;PLS1 3.111173e-07 475.728744 HDSigDB_Mouse_2021 22.625434 0 0 11/1035 7.385875e-10 320
130 Top Oligodendrocyte-Expressed Genes In Humans And Mice NRBP2;GPRC5B;GPR37;EFNB3;SCCPDH;WSCD1;DCTN2;PCDH9;KIF3A;ZFP365;COPE 3.111173e-07 464.394062 HDSigDB_Mouse_2021 22.258547 0 0 11/1051 8.690428e-10 321
131 Mouse Cortex Mature Oligodendrocyte Markers DOCK5;NRBP2;GPRC5B;GPR37;EFNB3;SCCPDH;WSCD1;SHISA4;COPE;PLS1;LRRC4B 7.987744e-05 182.278061 HDSigDB_Mouse_2021 12.129336 0 0 11/1840 2.974951e-07 322
132 Transmembrane Receptors Encoding Genes Enriched In Myelinating Oligodendrocytes GPRC5B;GPR37;EFNB3 1.237809e-04 3615.701150 HDSigDB_Mouse_2021 251.672269 0 0 3/17 5.762613e-07 323
133 Mouse Cerebellum Mature Oligodendrocyte Markers DOCK5;GPRC5B;GPR37;EFNB3;SCCPDH;WSCD1;SHISA4;PLS1;LRRC4B 2.605618e-04 163.098887 HDSigDB_Mouse_2021 12.135283 0 0 9/1271 1.455653e-06 324
168 KRAS.KIDNEY UP.V1 UP GPRC5B;GPR37;WSCD1;PCDH9 3.754310e-04 399.353853 MSigDB_Oncogenic_Signatures 35.175532 0 0 4/145 1.173222e-05 1396
134 Genes Up-Regulated In The Astrocytes Of zQ175 KI Mice Vs WT At 12 Month Old GSE124846 BSCL2;DOCK5;NRBP2;SCCPDH;WSCD1;PCDH9;PLS1 8.434368e-04 166.978595 HDSigDB_Mouse_2021 13.787053 0 0 7/758 5.497261e-06 325
135 Striatum RNA M47 Module (Bisque4) DOCK5;GPR37;WSCD1;SHISA4 8.751972e-04 489.941434 HDSigDB_Mouse_2021 41.030992 0 0 4/125 6.519160e-06 326
136 The Global Proteome Data Of The Soluble Fraction From The Brains Of Q175 And WT Mice DOCK5;GPR37;DCTN2;SHISA4;NRBP2;GPRC5B;EFNB3;SCCPDH;KIF3A;MPC2;COPE;PLS1;LRRC4B 1.341768e-03 87.593047 HDSigDB_Mouse_2021 7.686508 0 0 13/3901 1.124386e-05 327
OPC up 173 spastic paraplegia PNPLA6 3.153280e-02 117.076820 OMIM_Disease 33.869270 0 0 1/32 3.153280e-02 1173
172 SIRNA EIF4GI DN DCTN6;SRPK1 4.783250e-02 123.851850 MSigDB_Oncogenic_Signatures 22.775487 0 0 2/99 4.348409e-03 1162
Oligodendrocyte up 174 Genes Down-Regulated In Myotonic Dystrophy 2 Markers In Human Skeletal Muscle E-D-7014 DPAGT1;CENPX;TST;9130401M01RIK;SLC35C2;EPHX1;FUZ;CRIP2;SMCR8;RFNG;APTX;LY6E 1.309332e-02 86.403136 HDSigDB_Mouse_2021 7.667941 0 0 12/3281 1.277397e-05 447
177 Aflatoxin B1 Metabolism WP1262 EPHX1 1.991450e-02 1393.123889 WikiPathways_2024_Mouse 262.842105 0 0 1/5 4.990441e-03 1516
179 Aflatoxin B1 metabolism WP1262 EPHX1 1.991450e-02 1393.123889 WikiPathways_2019_Mouse 262.842105 0 0 1/5 4.990441e-03 1520
178 Fatty Acid Oxidation WP2318 SLC25A29 1.991450e-02 538.335775 WikiPathways_2024_Mouse 116.789474 0 0 1/10 9.957248e-03 1517
180 Fatty acid oxidation WP2318 SLC25A29 1.991450e-02 538.335775 WikiPathways_2019_Mouse 116.789474 0 0 1/10 9.957248e-03 1521
175 VEGF A UP.V1 UP EPHX1;RFNG;LY6E 3.083421e-02 126.205684 MSigDB_Oncogenic_Signatures 18.092350 0 0 3/196 9.343700e-04 1482
176 STK33 NOMO DN DPAGT1;VAT1;SLC35C2 4.819711e-02 70.168775 MSigDB_Oncogenic_Signatures 12.023814 0 0 3/292 2.921037e-03 1483
Overall up 233 Negative Regulation Of Peptidase Activity (GO:0010466) SERPINE2;TIMP2;NRG1;CTSB 9.062129e-05 1324.283459 GO_Biological_Process_2023 88.946429 0 0 4/60 3.419671e-07 2017
234 Negative Regulation Of Proteolysis (GO:0045861) SERPINE2;TIMP2;CTSB 1.178829e-03 1077.036200 GO_Biological_Process_2023 92.609907 0 0 3/41 8.896824e-06 2018
236 Negative Regulation Of Endopeptidase Activity (GO:0010951) SERPINE2;TIMP2;NRG1 1.897170e-03 568.434094 GO_Biological_Process_2023 55.789916 0 0 3/66 3.758775e-05 2020
235 Negative Regulation Of Platelet Aggregation (GO:0090331) SERPINE2;CD9 1.897170e-03 3897.964407 GO_Biological_Process_2023 369.888889 0 0 2/8 2.650430e-05 2019
238 Regulation Of Endopeptidase Activity (GO:0052548) SERPINE2;TIMP2;NRG1 1.897170e-03 535.407712 GO_Biological_Process_2023 53.245989 0 0 3/69 4.295480e-05 2022
237 Negative Regulation Of Homotypic Cell-Cell Adhesion (GO:0034111) SERPINE2;CD9 1.897170e-03 2791.902845 GO_Biological_Process_2023 277.388889 0 0 2/10 4.254530e-05 2021
239 Negative Regulation Of Platelet Activation (GO:0010544) SERPINE2;CD9 3.746939e-03 1573.576348 GO_Biological_Process_2023 170.658120 0 0 2/15 9.897575e-05 2023
240 Heart Trabecula Morphogenesis (GO:0061384) S1PR1;NRG1 4.768772e-03 1226.393330 GO_Biological_Process_2023 138.638889 0 0 2/18 1.439629e-04 2024
201 Status Epilepticus C0038220 rat sample 391 SERPINE2;VGF;TIMP2;CD9;CTSB 5.809842e-03 218.064714 Disease_Perturbations_from_GEO_up 19.787513 0 0 5/336 1.636575e-05 146
243 Negative Regulation of Platelet Aggregation (GO:0090331) SERPINE2;CD9 5.846481e-03 3261.459893 GO_Biological_Process_2025 317.031746 0 0 2/9 3.405660e-05 2282
No description has been provided for this image